开发者

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

开发者 https://www.devze.com 2023-01-26 14:11 出处:网络
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.

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

精彩评论

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