开发者

Is there an OR filter? - Django

开发者 https://www.devze.com 2023-01-02 07:18 出处:网络
is there any way of doing the following Unicorn.objects.or_filter(magical=True).or_filter(unicorn_length=15).or_filter(开发者_运维百科skin_color=\'White\').or_filter(skin_color=\'Blue\')

is there any way of doing the following

Unicorn.objects.or_filter(magical=True).or_filter(unicorn_length=15).or_filter(开发者_运维百科skin_color='White').or_filter(skin_color='Blue')

where or_filter stands for an isolated match


I remember using something similar but cannot find the function anymore!

Help would be great! Thanks :)


You're looking for Q objects.

0

精彩评论

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