I have two models : class Individual(models.Model): name = models.CharField(max_length=200) * is_author = models.BooleanField()* active = models.BooleanField(default=True) ---------------------------------------------------------------------------------------------------- class Book(models.Model): title = models.CharField(max_length=200) *authors = models.ManyToManyField(Individual, related_name="author_for", blank=True, null=True)* ------------------------------------------------------------------------------------------------------------------
Can i make the query to get all the books that is_author? i have tried: >>>authors = Individual.objects.filter(is_author=True).filter(active=True) >>>for author in authors: print author.name for book in author.book_set.all(): print book.title --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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 -~----------~----~----~----~------~----~------~--~---