That's a very good question, Dougal, and I'm too much of a noob to be
able to answer it. I THINK those lookups are lazy, but I'd love to
hear from someone who knows more about it.
On Feb 14, 8:47 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> The problem I have with this is that, if I'm correctly understand what
> goes on, when I do a select_related all the related objects are
> retrieved. In this case, if a user has made, say, 4000 posts plus
> other types of contributions, it seems like it's pulling in a lot of
> unnecessary data.
>
> Am I misunderstanding or is this correct?
>
> Thanks for the ideas,
> -Dougal
>
> On Feb 14, 11:46 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > I just use a generic list view and send it
> > user_dict = {
> > 'queryset': GpUser.objects.all(),}
>
> > GpUser is my model that extends auth.user
>
> > On Feb 14, 2:47 am, "Aidas Bendoraitis" <[EMAIL PROTECTED]>
> > wrote:
>
> > > Your profile perhaps is related by a foreign key to the user, which
> > > means that theoretically one user can have several profiles.
> > > Therefore, in my opinion, you should get the profiles and use
> > > select_related() for related users.
>
> > > profiles =
> > > UserProfile.objects.select_related().order_by('user__id')[offset:limit]
>
> > > Regards,
> > > Aidas Bendoraitis [aka Archatas]
>
> > > On 2/14/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > > > Hi,
>
> > > > I have a site with users and an additional user_profile to store extra
> > > > information like a signature, avatar, etc.
>
> > > > I cannot figure out how to use a single query to get a list of users
> > > > and at the same time join in their user_profile information.
>
> > > > Currently I have this:
>
> > > > users = User.objects.all().order_by('id')[offset:limit]
>
> > > > But I can't figure out how to get their profiles joined to that query.
> > > > Any ideas?
>
> > > > thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---