Sort cards in deck view
This commit is contained in:
parent
0f7d70da83
commit
f6945e0fe7
2 changed files with 3 additions and 1 deletions
|
@ -31,6 +31,8 @@ class Deck(models.Model):
|
||||||
cards = models.ManyToManyField(Card, through='Included')
|
cards = models.ManyToManyField(Card, through='Included')
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
def get_cards(self):
|
||||||
|
return self.included_set.all().order_by('card__type__name')
|
||||||
def lands(self):
|
def lands(self):
|
||||||
symbols = {}
|
symbols = {}
|
||||||
for symbol in mtg.Mana.types.keys():
|
for symbol in mtg.Mana.types.keys():
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
</section>
|
</section>
|
||||||
<section class="cards">
|
<section class="cards">
|
||||||
<h3>Cards</h3>
|
<h3>Cards</h3>
|
||||||
{% regroup deck.included_set.all by card.type as cards %}
|
{% regroup deck.get_cards by card.type as cards %}
|
||||||
<ul>
|
<ul>
|
||||||
{% for group in cards %}
|
{% for group in cards %}
|
||||||
<li class="card-type">{{ group.grouper|title }}
|
<li class="card-type">{{ group.grouper|title }}
|
||||||
|
|
Loading…
Reference in a new issue