changed roster page to display by division

This commit is contained in:
Erin Braswell 2012-05-30 23:35:35 -04:00
parent b47f3e0eec
commit 18363a08b2
2 changed files with 18 additions and 6 deletions

View File

@ -11,16 +11,27 @@
<table class="table">
<thead>
<tr>
<th>Stars</th>
<th>Raw</th>
<th>Smackdown</th>
<th>Divas</th>
</tr>
</thead>
<tbody>
{% for star in stars %}
{% for star_set in star_sets %}
<tr>
<td>{{star}}<span class="label {{star.division}}">{{star.division}}</span></td>
{% for star in star_set %}
<td>{{star}}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
<h2>Others</h2>
<ul>
{% for other in others %}
<li>{{other}}</li>
{% endfor %}
</ul>
{% endblock %}

View File

@ -159,10 +159,11 @@ def roster(request, league_id):
divisions = {'raw': [], 'smackdown': [], 'other': [], 'divas': []}
for star in Star.objects.all():
divisions[star.division].append(star)
stars = izip_longest(divisions['raw'], divisions['smackdown'],
divisions['divas'], divisions['other'])
star_sets = izip_longest(divisions['raw'], divisions['smackdown'],
divisions['divas'], fillvalue='')
context = {
'stars': stars,
'star_sets': star_sets,
'others': divisions['other'],
'view': 'roster',
'league': league,
'leagues': leagues