2👍
✅
from django.db.models import Q
# drivers who have either have a "Yugo" as their primary car,
# or have a relation to one
yugo_drivers = Driver.objects.filter(Q(primary_car__name__iexact="Yugo") |
Q(cars__name__iexact="Yugo"))
Two things that will help you out are:
👤Matt
- [Answered ]-Django User model and Userprofile model in the same form
- [Answered ]-Persisting user selected data in Django application
- [Answered ]-Add warning message in django-rest-framework
- [Answered ]-Getting correct local time zone to display for end-users in Django web app
Source:stackexchange.com