Is there an OR filter? - Django

核能气质少年 提交于 2019-12-10 09:56:50

问题


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 :)


回答1:


You're looking for Q objects.



来源:https://stackoverflow.com/questions/2964540/is-there-an-or-filter-django

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!