order editions by most recent to oldest

pull/1/head
Ed Summers 2011-10-20 05:42:49 +00:00
parent 07073f8620
commit e164744872
2 changed files with 4 additions and 3 deletions

View File

@ -10,10 +10,10 @@
<div class="content-block">
<h1>{{ work.title }}</h1>
<h2>{{ work.editions.all.count }} Editions:</h2>
<h2>{{ editions.all.count }} Editions:</h2>
<ul class="edition-list">
{% for edition in work.editions.all %}
{% for edition in editions %}
<li class="edition">
<div style="float: left; margin-right: 10px;">
<img class="cover" src="{{ edition.cover_image_small }}" />

View File

@ -32,7 +32,8 @@ def home(request):
def work(request, work_id):
work = get_object_or_404(models.Work, id=work_id)
return render(request, 'work.html', {'work': work})
editions = work.editions.all().order_by('-publication_date')
return render(request, 'work.html', {'work': work, 'editions': editions})
def supporter(request, supporter_username):
supporter = get_object_or_404(User, username=supporter_username)