old_contents: from photologue.views import GalleryListView
  from photologue.views import GalleryDetailView
  from photologue.views import GalleryDateView
  from photologue.views import PhotoListView
  from photologue.views import PhotoDetailView
  from photologue.views import PhotoDateView
  from django.conf import settings
  from django.shortcuts import redirect
  from django.contrib.auth.mixins import LoginRequiredMixin
  
  class GalleryListView(LoginRequiredMixin,ListView):
      queryset = Gallery.objects.on_site().is_public()
      paginate_by = 20
  
  class GalleryDetailView(LoginRequiredMixin, DetailView):
      queryset = Gallery.objects.on_site().is_public()
  
  class PhotoListView(LoginRequiredMixin,ListView):
      queryset = Photo.objects.on_site().is_public()
      paginate_by = 20
  
  
  class PhotoDetailView(LoginRequiredMixin,DetailView):
      queryset = Photo.objects.on_site().is_public()
  
  
  class PhotoDateView(LoginRequiredMixin,object):
      queryset = Photo.objects.on_site().is_public()
      date_field = 'date_added'
      allow_empty = True
new_contents: from django.views.generic.dates import ArchiveIndexView, DateDetailView, DayArchiveView, MonthArchiveView, \
      YearArchiveView
  from django.views.generic.detail import DetailView
  from django.views.generic.list import ListView
  from photologue.models import Photo, Gallery
  from photologue.views import GalleryDateView, PhotoDateView
  from django.contrib.auth.mixins import LoginRequiredMixin
  
  
  # Gallery views.
  class CustomGalleryListView(LoginRequiredMixin, ListView):
      queryset = Gallery.objects.on_site().is_public()
      paginate_by = 20
  
  
  class CustomGalleryDetailView(LoginRequiredMixin, DetailView):
      queryset = Gallery.objects.on_site().is_public()
  
  
  class CustomGalleryDateView(LoginRequiredMixin, object):
      queryset = Gallery.objects.on_site().is_public()
      date_field = 'date_added'
      allow_empty = True
  
  
  class CustomGalleryDateDetailView(LoginRequiredMixin, DateDetailView):
      pass
  
  
  class CustomGalleryArchiveIndexView(LoginRequiredMixin, GalleryDateView, ArchiveIndexView):
      pass
  
  
  class CustomGalleryDayArchiveView(LoginRequiredMixin, GalleryDateView, DayArchiveView):
      pass
  
  
  class CustomGalleryMonthArchiveView(LoginRequiredMixin, GalleryDateView, MonthArchiveView):
      pass
  
  
  class CustomGalleryYearArchiveView(LoginRequiredMixin, GalleryDateView, YearArchiveView):
      make_object_list = True
  
  # Photo views.
  
  
  class CustomPhotoListView(LoginRequiredMixin, ListView):
      queryset = Photo.objects.on_site().is_public()
      paginate_by = 20
  
  
  class CustomPhotoDetailView(LoginRequiredMixin, DetailView):
      queryset = Photo.objects.on_site().is_public()
  
  
  class CustomPhotoDateView(LoginRequiredMixin, object):
      queryset = Photo.objects.on_site().is_public()
      date_field = 'date_added'
      allow_empty = True
  
  
  class CustomPhotoDateDetailView(LoginRequiredMixin, PhotoDateView, DateDetailView):
      pass
  
  
  class CustomPhotoArchiveIndexView(LoginRequiredMixin, PhotoDateView, ArchiveIndexView):
      pass
  
  
  class CustomPhotoDayArchiveView(LoginRequiredMixin, PhotoDateView, DayArchiveView):
      pass
  
  
  class CustomPhotoMonthArchiveView(LoginRequiredMixin, PhotoDateView, MonthArchiveView):
      pass
  
  
  class CustomPhotoYearArchiveView(LoginRequiredMixin, PhotoDateView, YearArchiveView):
      make_object_list = True
  
  
  
  
  
  
  
subject: Update views.py