69👍
✅
Actually, you can pass multiple lookup parameters in QuerySet’s get() method. So how about?
try:
employee = Employee.objects.get(age=23, sex='female')
except Employee.DoesNotExist:
# no employee found
except Employee.MultipleObjectsReturned:
# what to do if multiple employees have been returned?
👤Haes
Source:stackexchange.com