Friday, August 6, 2010

Re: queryset field order

On Aug 6, 6:08 pm, owidjaya <owidj...@gmail.com> wrote:
> I checked it and the field order still not the same.
> Just to clarify. I want the to do this A.objects.all().values()
> and still get the each list in the result to have the same "field
> order" as the database table defined.

`values()` returns a set of dictionaries. Dictionaries are unordered
by definition.

`values_list()` returns a set of tuples, which should be in the same
order as the model definition, however you don't get the fieldnames.
--
DR.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment