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 pks (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

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -