django query set : retrieving/extracting objects with different primary keys (from a list) -
i trying grips django, , having trouble retrieving objects primary keys, come list. so, able following:
one_entry = entry.objects.get(pk=1)
this seems fine - no problems. now, have list of pk's so:
pk_id=[1,5,10,200,300,310]
i extract objects above pk
s (looping?) , make single queryset
. not sure looping best option - wondering if point me in right direction collect objects pk's list , return single resulting queryset.
maybe like:
entry.objects.filter(pk__in=pk_id)
Comments
Post a Comment