Public method for getting model field names in order of definition
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 django-developers@googlegroups.com To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~--~~~~--~~--~--~---
Re: Proposal: Tutorial Refresh
> * We should de-emphasize the "apps live inside of projects" thing. +1 on that. In fact I wonder whether we should in fact emphasize just the opposite -- that apps should *not* live inside of projects. I get that one of the purposes of the tutorial is to get you up and running fast, but when someone's trying to get a quick start and not really paying attention to comments like "we'll show how to de-couple later", they may just follow the pattern given and unconsciously assume that it's the usual way to do things. IMO startproject and startapp are misleading because 1) they sound necessary, but they're not; 2) they don't really do much for you; and 3) folks are led to use manage.py instead of django-admin, which causes confusion down the road. I'm not an expert in pedagogy, but it seems preferable to me to demonstrate best practices up front. 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 django-developers@googlegroups.com To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~--~~~~--~~--~--~---