diff options
Diffstat (limited to 'app/photos')
-rw-r--r-- | app/photos/urls.py | 14 | ||||
-rw-r--r-- | app/photos/views.py | 19 |
2 files changed, 31 insertions, 2 deletions
diff --git a/app/photos/urls.py b/app/photos/urls.py index 67375da..5978107 100644 --- a/app/photos/urls.py +++ b/app/photos/urls.py @@ -25,8 +25,18 @@ urlpatterns = [ RedirectView.as_view(url="/photos/galleries/private/1/", permanent=False) ), url( - r'galleries/(?P<slug>[-\w]+)/$', - views.gallery, + r'galleries/(?P<slug>[-\w]+)$', + views.Gallery.as_view(), + name="private" + ), + url( + r'galleries/(?P<page>\d+)/$', + views.GalleryList.as_view(), + name="private_list" + ), + url( + r'galleries/$', + RedirectView.as_view(url="/photos/galleries/1/", permanent=False) ), url( r'(?P<page>\d+)/$', diff --git a/app/photos/views.py b/app/photos/views.py index 4b89e4c..bb94fbe 100644 --- a/app/photos/views.py +++ b/app/photos/views.py @@ -29,6 +29,25 @@ class PrivateGalleryList(PaginatedListView): context['is_private'] = True return context +class Gallery(DetailView): + model = LuxGallery + slug_field = "slug" + template_name = "details/photo_gallery.html" + + +class GalleryList(PaginatedListView): + template_name = 'archives/gallery_list.html' + + def get_queryset(self): + return LuxGallery.objects.filter(is_public=True) + + def get_context_data(self, **kwargs): + # Call the base implementation first to get a context + context = super(GalleryList, self).get_context_data(**kwargs) + context['is_private'] = False + return context + + def gallery_list(request, page): request.page_url = '/photos/%d/' request.page = int(page) |