Re: Filtering parents by child attributes

2009-01-04 Thread Ronny Haryanto
On Fri, Jan 2, 2009 at 11:57 PM, Mathieu Steele wrote: > Here is an example of the data model for the type of filter I would > like to do: > > class Student > name > > class Absence > foreign key Student > date > > Is there a way to filter Students with no absences? > > somethin

Re: Filtering parents by child attributes

2009-01-04 Thread knight
Try something like: students = Student.objects.all() absences = Absences.objects.all() for absence in absences: students.remove(absence.fk) Maybe I'm wrong somewhere in the syntax, but the idea should be clear. Regards, Alex A. On Jan 2, 6:57 pm, Mathieu Steele wrote: > Here is an example

Filtering parents by child attributes

2009-01-02 Thread Mathieu Steele
Here is an example of the data model for the type of filter I would like to do: class Student name class Absence foreign key Student date Is there a way to filter Students with no absences? something like Student.objects.filter(absence_set__count=0) --~--~-~--~--