↧
Answer by linuxhackerman for merge querysets in django
For a perhaps more semantically clear solution:def get_all_players(self): return (self.players1.all() | self.players2.all()).distinct()
View ArticleAnswer by Tadeck for merge querysets in django
This should do the trick:# On the top of the file:from django.db.models import Q# Game instance method:def get_all_players(self): return Player.objects.filter(Q(games1__pk=self.pk) |...
View Articlemerge querysets in django
I have in models.py:class Game(models.Model): players1 = models.ManyToManyField(Player, related_name='games1') players2 = models.ManyToManyField(Player, related_name='games2') def...
View Article
More Pages to Explore .....