import json
from myapp.models import MyModel

x = json.dumps(MyModel.objects.values_list('myField', flat=True)) # "[] is 
not JSON serializable"
x = json.dumps([x for x in MyModel.objects.values_list('myField', flat=True
)]) #ok



####
It seems that the database is accessed only if the result of 
objects.filter()/all()/values_list()/... is printed/iterated/... .
It's fine, but I think the methods of model manager like 
filter()/all()/values_list() should behave as if it is processing python 
objects. I have not yet digged into json module, but it did penetrated 
django's disguise.

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3b9e4426-e192-48b6-b1cf-fe802ecabecb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to