From f6945e0fe727994c75313380c580f0066a337ecf Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Wed, 22 Sep 2010 22:20:57 -0400 Subject: [PATCH] Sort cards in deck view --- analyzer/models.py | 2 ++ templates/decks/detail.html | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) 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 %}