Re: How to override the functionality of values()

2017-06-08 Thread Mallik Sai
By writing a custom method in ActiveQuerySet manager https://stackoverflow.com/questions/44368818/fetch-json-field-value-using-values-in-django On Thursday, June 8, 2017 at 4:44:35 PM UTC+5:30, Mallik Sai wrote: > > I my models I have a JSON Field and I want to get a particular key value > from j

Re: How to get JOSN Field key value using values()

2017-06-08 Thread Mallik Sai
I have written a custom ActiveQuerySet method for it. You can find the solution in the following link which works for simple JSON structure. https://stackoverflow.com/questions/44368818/fetch-json-field-value-using-values-in-django On Thursday, June 8, 2017 at 4:45:08 PM UTC+5:30, Mallik Sai wrot

Same form saving to related models

2017-06-08 Thread Elorm Koku
Hi guys, I need a means to save these 2 models related by FK but I want to use one form. I searched but I jus can't do it. class Student(models.Model): ... class Parent(models.Model): child = models.ForeignKey(Student) All I need is a form I can use to every student and their paren

Re: Source Code for Django + Python + Postgres

2017-06-08 Thread Melvyn Sopacua
On Thursday 08 June 2017 07:37:03 Freddie Rodrigues wrote: > I am very new to Django. Can you guide to the best source code for an > Accounting ERP kind of project. Python with PostgreSQL is my preferred > choice. Probably the closest you're gonna get is this grid: https://djangopackages.org/gr

Re: Source Code for Django + Python + Postgres

2017-06-08 Thread Ezequiel Bertti
Start building your models and admin. After that, think about deploy, like heroku or docker. But try to find already read apps to help you to build your ERP. Watch this awesome list: http://awesome-django.com/ On Thu, Jun 8, 2017 at 11:37 AM, Freddie Rodrigues wrote: > Hi all, > > I am very

Source Code for Django + Python + Postgres

2017-06-08 Thread Freddie Rodrigues
Hi all, I am very new to Django. Can you guide to the best source code for an Accounting ERP kind of project. Python with PostgreSQL is my preferred choice. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and st

Re: How to get JOSN Field key value using values()

2017-06-08 Thread pradam programmer
Hi Mallik, Write a Custom Method to do it. On Thu, Jun 8, 2017 at 3:21 PM, Mallik Sai wrote: > I have a JSON Field in my model and I want to get a particular Key value > which is present in the JSON Field using values(). > > lets assume my JOSN Field data is like { 'key1':value1 , 'key2':value2

Re: Authentication backend - serialization

2017-06-08 Thread Alison P
Hi! Ludovic, Melvyn, thank you for your responses. I could not make Melvyn's example work for me, but it put me on the right track. Solution: right under the "reset the one time password" comment, add the line "user.backend = 'path.to.OneTimePasswordBackend' ", and everything works as it shoul

Re: request.GET as an OrderedDict

2017-06-08 Thread Todor Velichkov
Did you consider just trying something like this: from django.http import QueryDict from collections import OrderedDict class OrderedQueryDict(QueryDict, OrderedDict): pass my_dict = OrderedQueryDict(request.META['QUERY_STRING']) print request.META['QUERY_STRING']

How to get JOSN Field key value using values()

2017-06-08 Thread Mallik Sai
I have a JSON Field in my model and I want to get a particular Key value which is present in the JSON Field using values(). lets assume my JOSN Field data is like { 'key1':value1 , 'key2':value2 ,'key3':value3 } I want to give the query like MyModel.objects.values('field1' , 'field2' , 'key2(w

How to override the functionality of values()

2017-06-08 Thread Mallik Sai
I my models I have a JSON Field and I want to get a particular key value from json field in using values(). assume my JOSN Field data is like {'key1':value1,'key2':value2,'key3':value3} eg: MyModel.objects.values( "field1", "field2", "key1(which is present in json field)" ) Is there any way

Re: request.GET as an OrderedDict

2017-06-08 Thread Melvyn Sopacua
On Thursday 08 June 2017 20:01:24 Bernd Wechner wrote: > Bad idea? A subjectivity at best to be honest. True. In HTTP there is only data (through forms) and state (through cookies). Ordering of data is under (malicious) user control. Now, if the scope of ordering is fixed and not dynamic, then p

Re: request.GET as an OrderedDict

2017-06-08 Thread Bernd Wechner
Bad idea? A subjectivity at best to be honest. But yes, I was thinking I could pull it from the querystring but also would rather not reparse something already done, let alone in a framework I and many jumped on because it's DRY ;-) The problem I'm solving is not a mission critical thing by an

Re: Adding a attribute to a model property

2017-06-08 Thread Bernd Wechner
Melvyn, Aha, thanks for the insight. Found it at last. "Property" is an amazingly difficult word to search for as it happens. Still my problem remains. But this: "Changed in version 3.5: The docstrings of property objects are now writeable." is hopeful. Suggesting if the docstring can be wri

Re: request.GET as an OrderedDict

2017-06-08 Thread Melvyn Sopacua
On Thursday 08 June 2017 17:11:36 Bernd Wechner wrote: > Am curious if there's an easy way to walk through request.GET in the > order they appeared on the URL? It strikes me the dictionary has lost > this ordering information, and I wonder if it's available anywhere or > how one might extend Djan

Re: Adding a attribute to a model property

2017-06-08 Thread Melvyn Sopacua
On Thursday 08 June 2017 16:18:42 Bernd Wechner wrote: > This works charmingly. Though I admit I don't fully understand it. The > type "property" passed to isinstance seems to be a built in type as I > don't import it anywhere and I can't find a definition (I use PyDev > and it brilliantly lets me

Re: Django graceful database errors

2017-06-08 Thread Melvyn Sopacua
On Thursday 08 June 2017 09:09:32 Antonis Christofides wrote: > not answering exactly what you asked, by my 2 cents anyway: > > Why do you want to do this? Erm, that's actually good practice. This error isn't permanent and can resolve itself, so you can inform the user to try again in 5 minute

request.GET as an OrderedDict

2017-06-08 Thread Bernd Wechner
Am curious if there's an easy way to walk through request.GET in the order they appeared on the URL? It strikes me the dictionary has lost this ordering information, and I wonder if it's available anywhere or how one might extend Django to supply an OrderedDict when requested? Kind regards, B