Q django
from django.db.models import Q
Q(question__startswith='Who') | Q(question__startswith='What')
Attractive Ape
from django.db.models import Q
Q(question__startswith='Who') | Q(question__startswith='What')
from django.db.models import Q
obj, created = Person.objects.filter(
Q(first_name='Bob') | Q(first_name='Robert'),
).get_or_create(last_name='Marley', defaults={'first_name': 'Bob'})
from django.db.models import Q
@api_view(["GET"])
def querybyCategory(request):
products = Product.objects.filter(
Q(category="Fashion") & Q(name__icontains="silk")
).order_by("-id")