开发者

Django - How to specify 'NOT IN' in 'limit_choices_to'?

How to specify 'NOT IN' in 'limit_choices_to'? I just want to fetch all the customer deta开发者_Python百科ils except if they are in one particular status.

customer = models.ForeignKey(Customer, limit_choices_to={'status__in': ['active']}) 


Just used the Q object instead of a dictionary.

limit_choices_to = ~models.Q(status__in = ['xxxxxx']))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜