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,

Bernd

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/acfcb49c-c8ad-cd92-a735-4183294f59b5%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


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 minutes.

Granted, for a normal public website, you've lost the user already. 
But for a web application used by subscribers, they will grab a coffee 
and convo at the watercooler and try again.
-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2553044.2U30SA9Fyo%40devstation.
For more options, visit https://groups.google.com/d/optout.


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 select almost anything and press F3 and
> takes me to its definition, but not for this 'property' keyword). And
> yet it's not documented here:
> 
> https://docs.python.org/3.1/library/stdtypes.html

Nope, because it's a built-in function[1].
-- 
Melvyn Sopacua


[1] https://docs.python.org/3/library/functions.html

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4602190.fOoObd2v9N%40devstation.
For more options, visit https://groups.google.com/d/optout.


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 Django to supply an OrderedDict when 
requested?

Bad idea. What are you trying to solve that requires an ordering in 
parameters?

If you're deadset on it, you can always grab the original query string 
(request.META.query_string) and split it's components yourself.
-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4059283.0tOvQjxIds%40devstation.
For more options, visit https://groups.google.com/d/optout.


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 written and 
read it can be used to communicate as desired (metadata about the 
property), albeit in a sub-optimal and proxy manner I guess. I wonder if 
I can work out how to do that? We shall see, about to put a 3 year old 
to bed and may fall asleep in the process ;-).


Bernd.

Melvyn Sopacua wrote:


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 select almost anything and press F3 and

> takes me to its definition, but not for this 'property' keyword). And

> yet it's not documented here:

>

> https://docs.python.org/3.1/library/stdtypes.html

Nope, because it's a built-in function 
.


--

Melvyn Sopacua

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4602190.fOoObd2v9N%40devstation 
.

For more options, visit https://groups.google.com/d/optout.



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/622b6e2d-58ec-091c-7e65-9c836a0ffd81%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


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 any measure, 
only a nicety for completeness. Sometimes (often) the order of events 
makes a difference (code being a classic and ubiquitous example ;-) and 
that applies to commands, and to requests (which are in the family of 
commands). But I can resolve it also by:


a) forcing a consistency on the incoming parameters (rejecting daft 
things with an error)
b) forcing a priority on the parameters I receive through GET (i.e. 
having a defined result no matter how daft the parameters are) , or
c) passing a single parameter that is an ordered string with another 
delimeter (not &), thus passing an order in.


Arguably a) is ideal, which leads to you "bad idea" observation but 
there are loads of options really, it just surprised me in a sense that 
an ordered string comes in and some of that information is discarded and 
not made easily available is all.


Regards,

Bernd.


Melvyn Sopacua wrote:


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 Django to supply an OrderedDict when requested?

Bad idea. What are you trying to solve that requires an ordering in 
parameters?


If you're deadset on it, you can always grab the original query string 
(request.META.query_string) and split it's components yourself.


--

Melvyn Sopacua

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4059283.0tOvQjxIds%40devstation 
.

For more options, visit https://groups.google.com/d/optout.



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0e772ee4-ecdb-e4ab-2360-f42590fcc160%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


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 perhaps it's worth 
writing the code. 
But the more parameters are added, the more complex it becomes, so keeping 
input validation 
to "just" verifying presence and sanity of data is preferable. This is a 
complex enough task as is.

> 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 any
> measure, only a nicety for completeness. Sometimes (often) the order
> of events makes a difference (code being a classic and ubiquitous
> example ;-) and that applies to commands, and to requests (which are
> in the family of commands). But I can resolve it also by:
> 
> a) forcing a consistency on the incoming parameters (rejecting daft
> things with an error)
> b) forcing a priority on the parameters I receive through GET (i.e.
> having a defined result no matter how daft the parameters are) , or
> c) passing a single parameter that is an ordered string with another
> delimeter (not &), thus passing an order in.

d) Use a formset and let the ordering work out by itself (under the hood via 
incremental naming 
of form elements, which you get back as an (ordered) list).

> Arguably a) is ideal, which leads to you "bad idea" observation but
> there are loads of options really, it just surprised me in a sense
> that an ordered string comes in and some of that information is
> discarded and not made easily available is all.

This may come as a surprise, but there is no standard for the format of the 
query string, beyond 
it should start with a question mark and is terminated by the fragment 
separator (#). 
The only guarantee of ordering you get is that a browser shall order the form 
elements in "tree 
order"[1]. With a static DOM tree, that's not an issue. When it's dynamic, then 
you need to put 
ordering logic in both the frontend and backend bit. When it's a link, it won't 
modify what is 
there. Hence, this gets back to scope as mentioned above.

The interpretation of duplicate keys is yet another topic of confusion[2].

Thus frameworks have learned to use either c) or d) or to avoid the query 
string all together 
using JSON as transmission format with POST as request method.

P.S. If you're building this query string over the course of several requests, 
consider using 
sessions (though that's not a guarantee it becomes less complex, just a 
different way of doing 
it).
-- 
Melvyn Sopacua


[1] https://www.w3.org/TR/html5/forms.html#constructing-the-form-data-set
[2] 
https://stackoverflow.com/questions/1746507/authoritative-position-of-duplicate-http-get-query-keys

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1867973.XK4gdVIMHs%40devstation.
For more options, visit https://groups.google.com/d/optout.


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 to get json field key value directly or how can I override 
the functionality of values() method.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4620ccf9-2945-4776-88f5-89c396d718dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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(which is present in Json Field)')

Please help me whether I can get in using values() or How can I override 
the values() functionality

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/127677de-e547-47cc-802f-9c59b5ebf839%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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']
print my_dict.items()


On Thursday, June 8, 2017 at 10:12:31 AM UTC+3, 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 Django to supply an OrderedDict when requested?
>
> Kind regards,
>
> Bernd
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/af162e78-8e16-4c19-b4e0-6c4288ca1385%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 should be! 

Have a nice day!
A.

On Monday, June 5, 2017 at 1:33:28 PM UTC+2, Alison P wrote:
>
> Hi everyone,
>
> I have written a custom authentication backend, the code is below. It 
> allows a user to click "email me a one-time password" on the home page, 
> which is saved on the "Person" model (which extends User through a foreign 
> key) and then log in with that password. This backend verifies the password 
> and then erases it from the database. 
> This whole thing works when I put 
> SESSION_SERIALIZER='django.contrib.sessions.serializers.PickleSerializer' 
> in settings.py, but I don't want that since PickleSerializer is unsafe. 
>
> If I use the default session serializer, I get the following error: 
> TypeError at /login/ 
>
>  is not JSON serializable
>
>
> how do I solve this? Do I need to write a custom serializer, and if yes, 
> how? Can I add serialize/deserialize methods on this class, and what 
> exactly do they need to do? Do they need to be classmethods or something?
>
> I would really appreciate some help with this. Thanks in advance!
>
> from django.contrib.auth.models import User
> from allauth.account.models import EmailAddress
> from passlib.hash import pbkdf2_sha256
> from api import models
> from base.settings import ACCOUNT_PASSWORD_MIN_LENGTH
>
> class OneTimePasswordBackend(object):
> def authenticate(self, email=None, one_time_password=None):
> if len(one_time_password) < ACCOUNT_PASSWORD_MIN_LENGTH or 
> one_time_password==None:
> return None
> try:
> email_obj = EmailAddress.objects.get(email=email)
> except EmailAddress.DoesNotExist:
> return None
> user = email_obj.user
> person = models.Person.objects.get(user_account=user)
> saved_pw = person.one_time_password
> try:
> verify = pbkdf2_sha256.verify(one_time_password, saved_pw)
> except Exception as e:
> print(e)
> verify = False
> else:
> """reset the one time password"""
> person.one_time_password = ""
> person.save()
> return user
> return None
>
> def get_user(self, user_id):
> try:
> return User.objects.get(pk=user_id)
> except User.DoesNotExist:
> return None
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/98447391-5986-4986-b025-1e1a0aa9e462%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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
> ,'key3':value3 }
>
> I want to give the query like MyModel.objects.values('field1' , 'field2'
> , 'key2(which is present in Json Field)')
>
> Please help me whether I can get in using values() or How can I override
> the values() functionality
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/127677de-e547-47cc-802f-9c59b5ebf839%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGGVXBM7y0iE1q2%3D%3D-P%3DFbK4-wFDH3UUDXG71f%2BnkdB8SvnJRg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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 stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e606981c-7993-4403-b5cb-15fadb04556d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 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 stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/e606981c-7993-4403-b5cb-15fadb04556d%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Ezequiel Bertti

https://telegram.me/ebertti
https://twitter.com/ebertti
https://github.com/ebertti

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACrQMYqZBR-sG1m-_KCD2FcEdLMtJuSA0jsn4e-5ZeKhWMgnJA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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/grids/g/ecommerce/

But if you're not set on Django, ERPNext and Odoo are alternatives, 
however ERPNext is built on MariaDB.
-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/14700457.NSCvqQSHoL%40devstation.
For more options, visit https://groups.google.com/d/optout.


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 parent
simultaneously.
Am I doing this wrong? If so kindly correct me.
Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAG%2BabP8sVSiKpfkeWtkBrNCoipT1xE%2BPUUkuDNOgaPNd5zeaDw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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 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 
> ,'key3':value3 }
>
> I want to give the query like MyModel.objects.values('field1' , 'field2' , 
> 'key2(which is present in Json Field)')
>
> Please help me whether I can get in using values() or How can I override 
> the values() functionality
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/64172ca1-00b8-4e65-b82a-4e33cadfa70e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 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 to get json field key value directly or how can I 
> override the functionality of values() method.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/02b2c7e4-d519-4c33-aea8-30285dda9b40%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.