Worked like a charm. This was a limited case so I won't be needing any
checks to ensure that the ID's are all in the queryset since there are
only 5 or 6. Thanks again.

On Oct 20, 10:44 am, Shawn Milochik <sh...@milochik.com> wrote:
> Given a tuple/list of primary keys named ordered_ids and a queryset named 
> records:
>
> results = [records.get(pk = x) for x in ordered_ids]
>
> This is a naive example, as it assumes that ordered_ids will never have IDs 
> which don't exist in the queryset, but it gives a simple way to do what 
> you're asking for.
>
> Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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