'How to override Django Q() model?
I want to query like this in Django ORM
from django.db.models import Q
MyModel.objects.filter((Q(flag=True) & Q(model_num__gt=15)) | (Q(flag=True) & Q(model_num__lt=7)))
Are there any way I can restrict the (Q(flag=True) & Q(model_num__gt=15)) results to only first query element?
Do we need to override Q model or we are having another apporach?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
