Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an OR filter? - Django

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

like image 768
RadiantHex Avatar asked Dec 04 '25 17:12

RadiantHex


1 Answers

You're looking for Q objects.

like image 120
Ignacio Vazquez-Abrams Avatar answered Dec 06 '25 07:12

Ignacio Vazquez-Abrams



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!