Q Object is an object used to encapsulate a collection of keyword arguments. These keyword arguments are specified in as "Field Lookups"
If you need to execute more complex queries, you can use Q objects.
Q Objects can be combined using the & and | Operators. When an operator is used on two Q Objects, it yields a new Q object.
from django.db.models import Q
& (AND) Operator
Example: Student.objects.filter(Q(id=6) & Q(id=106))
| (OR) Operator
Example: Student.objects.filter(Q(id=6) | Q(id=108))
~ (Negation) Operator
Example: Student.objects.filter(~Q(id=6) )
0 Comments
Comment Rules :
1. Do not post Adult/illegal Links.
2. Try to comment in only मराठी / English Language.
3. Do not post other website's links which are useless.
4. Your Comment should be based on the Topic for other queries.
5. Do not use Abusive Language.
6. Respect each other.
Thank You for following the rules. Please Comment....