diff --git a/analyzer/models.py b/analyzer/models.py index 9ba2837..85d7a24 100755 --- a/analyzer/models.py +++ b/analyzer/models.py @@ -31,6 +31,8 @@ class Deck(models.Model): cards = models.ManyToManyField(Card, through='Included') def __unicode__(self): return self.name + def get_cards(self): + return self.included_set.all().order_by('card__type__name') def lands(self): symbols = {} for symbol in mtg.Mana.types.keys(): diff --git a/templates/decks/detail.html b/templates/decks/detail.html index 5ae56e5..8c33207 100755 --- a/templates/decks/detail.html +++ b/templates/decks/detail.html @@ -49,7 +49,7 @@

Cards

- {% regroup deck.included_set.all by card.type as cards %} + {% regroup deck.get_cards by card.type as cards %}