What would you all think about a Meta attribute for models for
select_related, analogous to ordering? i.e., default to selecting
these related fields for any query on this model.

For example, I have a model roughly like:

class Contribution(models.Model):
    # content...
    creator = models.ForeignKey(User)

Nearly every time I want to display a contribution, I'm going to want
the username. It would be nice if, instead of sprinkling
`select_related('creator__username')` all over the code (thanks for
that very nice addition though, Malcolm), I could just declare on the
model something like:

    class Meta:
        related = ('creator__username',)

Canceling could be done like `select_related('-creator__username')`
perhaps.

What do people think?

-Ken

--~--~---------~--~----~------------~-------~--~----~
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