On Jun 6, 4:13 pm, Andrew Fong <fongand...@gmail.com> wrote:
> Was hoping not to have to loop back through it -- but I guess I'll
> just have to suck it up and do it. Thanks.
>
If you've got the order already in model_pk_list, you can use the
order_by parameter to .extra() to get the results in that order
straight from the database.
x = MyModel.objects.filter(pk__in=model_pk_list).extra
(order_by=model_pk_list)
This works for MySQL at least, not sure about other backends.
--
DR.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---