How to get the difference of two querysets in Django?

前端 未结 4 1006
一个人的身影
一个人的身影 2020-12-29 04:41

I have to querysets. alllists and subscriptionlists

alllists = List.objects.filter(datamode = \'A\')
subscriptionlists = Membership.objects.filter(member__id         


        
4条回答
  •  有刺的猬
    2020-12-29 05:32

    You should be able to use the set operation difference to help:

    set(alllists).difference(set(subscriptionlists))
    

提交回复
热议问题