Cleanup routing and remove middleware
This commit is contained in:
parent
4514d7e020
commit
de6088ca5f
7 changed files with 25 additions and 45 deletions
|
|
@ -16,7 +16,8 @@ from django.utils.text import slugify
|
|||
from django.views.generic.detail import DetailView
|
||||
from django.views.generic.edit import FormView
|
||||
from photologue.models import Gallery, Photo
|
||||
from photologue.views import GalleryArchiveIndexView, GalleryYearArchiveView
|
||||
from photologue.views import (GalleryArchiveIndexView, GalleryYearArchiveView,
|
||||
PhotoDetailView)
|
||||
from PIL import Image
|
||||
from taggit.models import Tag
|
||||
|
||||
|
|
@ -39,7 +40,7 @@ class TagDetail(LoginRequiredMixin, DetailView):
|
|||
return context
|
||||
|
||||
|
||||
class CustomGalleryArchiveIndexView(GalleryArchiveIndexView):
|
||||
class CustomGalleryArchiveIndexView(LoginRequiredMixin, GalleryArchiveIndexView):
|
||||
"""
|
||||
Override to use event date
|
||||
"""
|
||||
|
|
@ -47,7 +48,7 @@ class CustomGalleryArchiveIndexView(GalleryArchiveIndexView):
|
|||
uses_datetime_field = False # Fix related object access
|
||||
|
||||
|
||||
class CustomGalleryYearArchiveView(GalleryYearArchiveView):
|
||||
class CustomGalleryYearArchiveView(LoginRequiredMixin, GalleryYearArchiveView):
|
||||
"""
|
||||
Override to use event date
|
||||
"""
|
||||
|
|
@ -55,7 +56,7 @@ class CustomGalleryYearArchiveView(GalleryYearArchiveView):
|
|||
uses_datetime_field = False # Fix related object access
|
||||
|
||||
|
||||
class CustomGalleryDetailView(DetailView):
|
||||
class CustomGalleryDetailView(LoginRequiredMixin, DetailView):
|
||||
"""
|
||||
Custom gallery detail view to filter on photo owner
|
||||
"""
|
||||
|
|
@ -102,13 +103,17 @@ class GalleryDownload(LoginRequiredMixin, DetailView):
|
|||
return response
|
||||
|
||||
|
||||
class CustomPhotoDetailView(LoginRequiredMixin, PhotoDetailView):
|
||||
pass
|
||||
|
||||
|
||||
class GalleryUpload(PermissionRequiredMixin, FormView):
|
||||
"""
|
||||
Form to upload new photos in a gallery
|
||||
"""
|
||||
form_class = UploadForm
|
||||
template_name = "photologue/upload.html"
|
||||
success_url = reverse_lazy("gallery-upload")
|
||||
success_url = reverse_lazy("photologue:pl-gallery-upload")
|
||||
permission_required = 'photologue.add_gallery'
|
||||
|
||||
def form_valid(self, form):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue