def show_homepage(request, nr): album_list = apage(Album.objects.all(), int(nr), ALBUM_NPP) # No album actually in this page. if not album_list and nr != 1: return HttpResponseRedirect('/photo/1/') return render_to_response('photo_homepage.html', {'album_list':album_list, 'page':get_page_dict(Album.objects.all(), ALBUM_NPP, str_homepage(), int(nr))}, context_instance=RequestContext(request))
def show_homepage(request, nr): catalog_list = apage(Catalog.objects.all(), int(nr), CATALOG_NPP) # No album actually in this page. if not catalog_list and nr != 1: return HttpResponseRedirect('/resources/1/') return render_to_response('res_all.html', {'catalog_list': catalog_list, 'page':get_page_dict(Catalog.objects.all(), CATALOG_NPP, str_homepage_url(), int(nr))}, context_instance=RequestContext(request))
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))
def show_catalog(request, catalog_id, nr): try: catalog = Catalog.objects.get(pk=catalog_id) except Catalog.DoesNotExist: return HttpResponseRedirect('/resources/') res_list = apage(ResFile.objects.filter(catalog__id=catalog_id), int(nr), RES_NPP) if not res_list and nr != 1: return HttpResponseRedirect(wrap_catalog_url(catalog_id, 1)) return render_to_response('res_cat.html', {'res_list':res_list, 'catalog':catalog, 'page':get_page_dict(ResFile.objects.filter(catalog__id=catalog_id), RES_NPP, str_catalog_url(catalog_id), int(nr))}, context_instance=RequestContext(request))