Bram - Smartelectronix wrote:
> 2. in the profile I'm generating some data, for example, the user's 
> avatar filename will use self.user.username to create the avatars path, 
> which will do yet another query (select ... from auth_user)!

Replying -partly- to my own message, this slightly lowers the cost:

in django\contrib\auth\models.py instead of doing:

self._profile_cache = model._default_manager.get(user__id__exact=self.id)

one could do:

self._profile_cache = 
model.objects.filter(user__id__exact=self.id).select_related()[0]

which solves the problem of yet another query while doing self.user in 
the profile. Is there anything against this?


  - bram

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

Reply via email to