Skip to content

Commit

Permalink
[enh] dirty displaying of the position of a mep in the score list
Browse files Browse the repository at this point in the history
  • Loading branch information
Psycojoker committed Aug 8, 2011
1 parent 6d5cc46 commit 051c5e5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apps/meps/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def autoTrophies(mep):

def score_sort(request):
return render_to_response("meps/mep_list.html",
{'object_list': sorted(MEP.objects.filter(active=True).exclude(score__isnull=True),
{'object_list': enumerate(sorted(MEP.objects.filter(active=True).exclude(score__isnull=True),
key=lambda x: x.total_score,
reverse=True)},
reverse=True), start=1),
'score': True},
context_instance=RequestContext(request))
6 changes: 6 additions & 0 deletions memopol2/templates/meps/mep_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ <h1>{% trans "Members of the European Parliament" %}</h1>
<table class="mep-list tablesorter">
{% include "meps/meps_table_thead.html" %}
<tbody>
{% if score %}
{% for place, mep in object_list %}
{% include "meps/meps_table_tr.html" %}
{% endfor %}
{% else %}
{% for mep in object_list %}
{% include "meps/meps_table_tr.html" %}
{% endfor %}
{% endif %}
</tbody>
</table>
{% endblock %}
1 change: 1 addition & 0 deletions memopol2/templates/meps/meps_table_thead.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<thead>
<tr>
{% if score %}<th filter='false' class="cell-score">Score</th>{% endif %}
<th filter='false' class="cell-name">MEP</th>
{% if not 'country' in hidden_fields %}<th filter-type='ddl' class="cell-country">Country</th>{% endif %}
{% if not 'group' in hidden_fields %}<th filter-type='ddl' class="cell-group">Group</th>{% endif %}
Expand Down
5 changes: 5 additions & 0 deletions memopol2/templates/meps/meps_table_tr.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{% load memopol2 i18n %}
<tr>
{% if score %}
<td>
{{ place }}
</td>
{% endif %}
<td>
<a href="{{ mep.get_absolute_url }}">{{ mep.last_name|upper }} {{ mep.first_name }}</a>
</td>
Expand Down

0 comments on commit 051c5e5

Please sign in to comment.