I know it's possible to combine filter parameters, so as to return a queryset of objects that meet all the conditions. And it's also possible to perform filters on related models.
Is it possible to do both at once? ie. Return a list of objects that have a related object meeting both of two conditions? eg. I'm trying to produce a list of Employees who have a related License of Type A which has not yet expired*. Using this queryset: list = Employee.objects.filter(licenses__Type="A", licenses__Expiry__gt=datetime.date.today) ... gives all Employees who have Type A licenses, and who also have *any* license that hasn't expired. I want to restrict it to employees for whom the Type A license and the unexpired license is the same. Can anyone give me a hint of the syntax I'd need to do this? I've been experimenting for a while with no luck. Thanks for your time! * I know it's simple to do this by filtering the License objects instead and using that to get a list of Employee names - but this is only part of a bigger view, for which I need to select the relevant Employee objects. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

