125👍
✅
Q objects
from django.db.models import Q
Contact.objects.filter(Q(last_name__icontains=request.POST['query']) |
Q(first_name__icontains=request.POST['query']))
13👍
result = Contact.objects.filter(last_name__icontains=request.POST['query']) | Contact.objects.filter(first_name__icontains=request.POST['query'])
👤Eric
- [Django]-Custom QuerySet and Manager without breaking DRY?
- [Django]-Django model inheritance: create sub-instance of existing instance (downcast)?
- [Django]-Django Setup Default Logging
Source:stackexchange.com