employees = Employee.objects.filter(age=23, sex=\'female\')
This would return a queryset.
If I assume this queryset only contains one result, h
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?