There is an existing ticket
(http://code.djangoproject.com/ticket/3275), which had been partially
implemented (http://code.djangoproject.com/ticket/3275#comment:10).
This commit adds the depth parameter, nice thing. Thanks!

The second parameter "fields" has not been added yet. It can help
reduce DB load a lot, especially when you are having deeply related
models, which seems a normal thing to me. For example:

class NewsTicker(models.Model):
    id = models.AutoField(primary_key=True)
    user = models.ForeignKey(User)

class UserProfile(models.Model):
    user = models.ForeignKey(User, unique=True)
    last_news = models.ForeignKey(NewsTicker, default=0)

UserProfile.objects.select_related().get(user__id=3)

this query ^^^ joins four tables (user table twice). But I am
currently not interested in the newsticker stuff, which causes to add
two tables (newsticker and user for the 2nd time).
see here: SELECT ... FROM `core_userprofile` , `auth_user`,
`core_newsticker`, `auth_user` `auth_user3`

With the fields parameter I could reduce the DB load a bit, which is relevant.
Calling:
    UserProfile.objects.select_related(fields=["user"]).get(user__id=3)
which would result in
    SELECT ... FROM `core_userprofile` , `auth_user`
would help a lot.

1) How can I help getting this functionality into trunk? (enhance the
patch, write doc, ...)
2) Is this something that would be accepted to go into the trunk at all?

thanks

-- 
cu

Wolfram

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