Could someone with some developer background take a look at my question below and let me know if my understanding is correct?
Let's say I have a Task model that contains a foreign key to a User: class Task(models.Model) owner = models.ForeignKey('auth.User') Now let's say I have a ModelForm that contains this owner field. When I render that form for an instance of a task, the django method models_to_dict() is called to get the initial values for the task. For my owner field, it sets the initial value to the numeric id of the user. This seems to negate any utility of select_related() when I am later rendering my form. For example, if my task is retrieved through a query and I have select_related set to 1, that query will do an extra lookup so that the owner's first name and last name are available with no additional sql query, assuming I am accessing them from the instance that the intial query returned. However, when I am rendering my form, the value passed in is just the id of the user, ie '1'. So my widget must now do a new lookup to get the actual user in order to print the first name and last name. Can anyone comment on whether my understanding is correct? Should I simply not be using select_related in this situation? Is it primarily intended for use from views.py, where you have more control over exactly how and when you reference the attributes of a model instance? Or is there some better way I could be making use of it? Thank you! Margie -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.