changeset 29:f61db5f82549

When displaying photos, display by id, ascending.
author Brian Neal <bgneal@gmail.com>
date Tue, 05 Apr 2011 23:05:55 +0000
parents a404f93a68d3
children e492aa7c70de
files mysite/band/views.py mysite/templates/band/photo_detail.html
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mysite/band/views.py	Thu Mar 31 00:14:34 2011 +0000
+++ b/mysite/band/views.py	Tue Apr 05 23:05:55 2011 +0000
@@ -182,9 +182,10 @@
 
 def photo_detail(request, id):
    gallery = get_object_or_404(Gallery, pk = id)
+   photos = gallery.photos.order_by('id')
    return render_to_response('band/photo_detail.html',
-         { 'gallery' : gallery },
-         context_instance = RequestContext(request))
+       {'gallery' : gallery, 'photos': photos },
+       context_instance = RequestContext(request))
 
 #######################################################################
 
--- a/mysite/templates/band/photo_detail.html	Thu Mar 31 00:14:34 2011 +0000
+++ b/mysite/templates/band/photo_detail.html	Tue Apr 05 23:05:55 2011 +0000
@@ -19,7 +19,7 @@
 {{ gallery.description|textile }}
 
 <div class="madeira-photo-list">
-{% for photo in gallery.photos.all %}
+{% for photo in photos %}
    <a href="{{ photo.image.url }}" class="fancybox" rel="madeira-gallery">
       <img src="{{ photo.get_thumbnail_url }}" alt="{{ photo.caption }}" title="{{ photo.caption }}" /></a>
 {% endfor %}