I hope my question is understood
For example, I have this model
class Area(models.Model):
area_id = models.IntegerField()
name = models.CharField()
last_name = models.CharField()
short_name = models.CharField()
I want to make a query with several parameters
If I do not find the first one, look for it for the second and so with the third
filter_areas = Area.objects.filter(area_id=3 | name='area_name' | short_name='are')
Like to an or |
You can use Q object here:
from django.db.models import Q
Area.objects.filter(Q(area_id=1)| Q(name='name') | Q(short_name='are'))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With