Mercurial > public > madeira
comparison band/views.py @ 141:2db040e89285
Order photo galleries by date added (reverse) instead of by id.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 23 Mar 2014 18:00:38 -0500 |
parents | e2868ad47a1e |
children | 312f198e8958 |
comparison
equal
deleted
inserted
replaced
140:fbdcb7b80a16 | 141:2db040e89285 |
---|---|
16 members = Member.objects.exclude(is_active=0) | 16 members = Member.objects.exclude(is_active=0) |
17 return render(request, 'band/bio.html', {'members': members}) | 17 return render(request, 'band/bio.html', {'members': members}) |
18 | 18 |
19 | 19 |
20 def photos_index(request): | 20 def photos_index(request): |
21 galleries = Gallery.objects.values('title', 'id').order_by('-id') | 21 galleries = Gallery.objects.values('title', 'id').order_by('-date_added') |
22 | 22 |
23 photo_ids = Photo.objects.filter(is_public=True).values_list('id', | 23 photo_ids = Photo.objects.filter(is_public=True).values_list('id', |
24 flat=True) | 24 flat=True) |
25 photo_ids = random.sample(photo_ids, 4) | 25 photo_ids = random.sample(photo_ids, 4) |
26 random_photos = Photo.objects.filter(id__in=photo_ids) | 26 random_photos = Photo.objects.filter(id__in=photo_ids) |