I have a list of IDs for objects that I need to grab, then I have to sort them by their timestamp. Here's how I was going to do it:
For i in object_ids:
instance = Model.objects.get(id = i)
# Append instance to list of instances
#sort the instances list
But there are two things that bother me:
- Is there no way to grab a collection of entries by a list of their IDs - without having to loop?
- Can I append arbitrary objects to the QuerySet just based on their IDs ?
Thanks,