2

django 2.1, python 3.6.

I have a list of items that could contain duplicates. When I pass it to the model and use the in filter, it removes the duplicates . Is there anyway to return a query set with each item in the list instead of each item in the deduped list

card_list = [1,1,2,3]    
qs = Card.objects.filter(id__in=card_list)

qs.count() yields 3 I is there a better command to use that 'in' or a way to join it back to the origial list so I can return with a 4 item queryset?

Thanks

Micah Pearce
  • 1,805
  • 3
  • 28
  • 61

0 Answers0