I have a dict made up of (id, rank) pairs. I'd like to perform a Django query on the ids such that the resultant queryset is ordered by rank (descending).
Getting the queryset is easy:
rankings = {...}
result = MyModel.objects.filter(id__in=rankings.keys())
It seems like the answer should involve some sort of annotation that I can use as part of the order_by but I can't figure out how to get there.
EDIT: I neglected to mention that I need the result to be a QuerySet as this is part of a tastypie API pipeline.