Bundle trimed down alternative to photologue

This commit is contained in:
Alexandre Iooss 2022-01-30 08:20:03 +01:00
parent 2da3419b8d
commit 5368a51a76
40 changed files with 2652 additions and 70 deletions

24
photologue/views.py Normal file
View file

@ -0,0 +1,24 @@
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic.dates import ArchiveIndexView, YearArchiveView
from django.views.generic.detail import DetailView
from .models import Gallery, Photo
class GalleryDateView(LoginRequiredMixin):
queryset = Gallery.objects.filter(is_public=True)
date_field = 'extended__date_start'
uses_datetime_field = False # Fix related object access
allow_empty = True
class GalleryArchiveIndexView(GalleryDateView, ArchiveIndexView):
pass
class GalleryYearArchiveView(GalleryDateView, YearArchiveView):
make_object_list = True
class PhotoDetailView(LoginRequiredMixin, DetailView):
queryset = Photo.objects.filter(is_public=True)