If I have a couple of models like these (just an example)....

class Parent(models.Model):
    name = models.CharField(max_length=100)

class Gender(models.Model):
    name = models.CharField(max_length=100)

class Child(models.Model):
    entity = models.ForeignKey(Entity, related_name=’children’)
    gender = models.ForeignKey(Gender)
    name = models.CharField(max_length=100)


How can i get a list of parents that _doesn't_ have a child of a
certain gender?

>>> gender = Gender.objects.get(name='female')
>>> Parent.objects.filter(#whatever that gets parents that doesn't have a child 
>>> with gender=gender#)

I'm completely lost here so please help me out.
If it was about getting parents with no children then
"children__isnull=True" should do it but now I don't know.
The answer is probably obvious but I'm suffering from a mental block
right here.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to