Exemple #1
0
def show_album(request, album_id, nr):
    try:
        album = Album.objects.get(pk=album_id)
    except Album.DoesNotExist:
        return HttpResponseRedirect('/photo/')
    photo_list = apage(Photo.objects.filter(album__id=album_id), int(nr), PHOTO_NPP)
    if not photo_list and nr != 1:
        return HttpResponseRedirect(wrap_album_url(album_id, 1))
    return render_to_response('photo_album.html',
                              {'photo_list':photo_list,
                               'album':album,
                               'page':get_page_dict(Photo.objects.filter(album__id=album_id),
                                                    PHOTO_NPP,
                                                    str_album_page(album_id),
                                                    int(nr))},
                              context_instance=RequestContext(request))
Exemple #2
0
 def url(self):
     return wrap_album_url(self.id, 1)