The values_list() query set method is useful for dumping data to CSV,
etc.  However, I find that I often want to use it without specifying
the field names (to get them all) and yet also include the field names
as the first row in my data export.  There is no "public" method for
getting all the names of a model's fields in the order of definition.
Model._meta.get_all_field_names() returns a sorted list, and one has
to read the source code to discover that one should (probably) use the
"attname" attribute of a field for its name rather than the "name"
attribute.  The ValuesQuerySet superclass of ValuesListQuerySet by
default sets its field names with:

[f.attname for f in self.model._meta.fields]

So, my question is: Do folks think that it would be good to have a
public method for getting the field names in order of definition?

Thanks,
David
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to