Thanks Malcolm, that is just what i needed. :D ..so simple
cheers

On Apr 7, 10:55 pm, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote:
> On Tue, 2009-04-07 at 14:57 -0700, thedja wrote:
> > Good day to you all,
>
> > Im using
> > q = Person.objects.filter(pk=query)
>
> > and i have this inside a FOR statement. So every time the loop starts
> > again q gets rewritten instead of adding the new objects.
>
> > for stuff in box:
> >         for thing in things:
> >                  if stuff==thing:
> >                            q = Person.objects.filter(pk=thing)
>
> Sounds like you might be wanting to extract all Person objects with pk
> values in a list, so build up the list, then query:
>
>         pk_vals = []
>         for stuff in box:
>            for thin in things:
>               if stuff == thing:
>                 pk_vals.append(thing)
>         q = Person.objects.filter(pk__in=pk_vals)
>
> Regards,
> Malcolm
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to