From 462e51bfdbb849634aedd0fb8bb65dd7b0301d02 Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Wed, 22 Sep 2010 23:48:05 -0400 Subject: [PATCH] Display deck card count --- 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 85d7a24..490495a 100755 --- a/analyzer/models.py +++ b/analyzer/models.py @@ -33,6 +33,8 @@ class Deck(models.Model): return self.name def get_cards(self): return self.included_set.all().order_by('card__type__name') + def card_count(self): + return sum([i.count for i in self.included_set.all()]) def lands(self): symbols = {} for symbol in mtg.Mana.types.keys(): diff --git a/templates/decks/detail.html b/templates/decks/detail.html index 8c33207..6439456 100755 --- a/templates/decks/detail.html +++ b/templates/decks/detail.html @@ -48,7 +48,7 @@
-

Cards

+

Cards [{{ deck.card_count }}]

{% regroup deck.get_cards by card.type as cards %}