Filter on event date in galleries list
This commit is contained in:
parent
3130913191
commit
dd5409d93e
2 changed files with 22 additions and 2 deletions
|
|
@ -1,8 +1,11 @@
|
|||
from django.urls import path
|
||||
from django.urls import path, re_path
|
||||
|
||||
from .views import TagDetail, GalleryDownload
|
||||
from .views import (CustomGalleryArchiveIndexView,
|
||||
CustomGalleryYearArchiveView, GalleryDownload, TagDetail)
|
||||
|
||||
urlpatterns = [
|
||||
path('tag/<slug:slug>/', TagDetail.as_view(), name='tag-detail'),
|
||||
path('gallery/', CustomGalleryArchiveIndexView.as_view(), name='pl-gallery-archive'),
|
||||
re_path(r'^gallery/(?P<year>\d{4})/$', CustomGalleryYearArchiveView.as_view(), name='pl-gallery-archive-year'),
|
||||
path('gallery/<slug:slug>/download/', GalleryDownload.as_view(), name='gallery-download'),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ from django.contrib.auth.mixins import LoginRequiredMixin
|
|||
from django.http import HttpResponse
|
||||
from django.views.generic import DetailView
|
||||
from photologue.models import Gallery
|
||||
from photologue.views import GalleryArchiveIndexView, GalleryYearArchiveView
|
||||
from taggit.models import Tag
|
||||
|
||||
|
||||
|
|
@ -26,6 +27,22 @@ class TagDetail(LoginRequiredMixin, DetailView):
|
|||
return context
|
||||
|
||||
|
||||
class CustomGalleryArchiveIndexView(GalleryArchiveIndexView):
|
||||
"""
|
||||
Override to use event date
|
||||
"""
|
||||
date_field = 'extended__date_start'
|
||||
uses_datetime_field = False # Fix related object access
|
||||
|
||||
|
||||
class CustomGalleryYearArchiveView(GalleryYearArchiveView):
|
||||
"""
|
||||
Override to use event date
|
||||
"""
|
||||
date_field = 'extended__date_start'
|
||||
uses_datetime_field = False # Fix related object access
|
||||
|
||||
|
||||
class GalleryDownload(LoginRequiredMixin, DetailView):
|
||||
model = Gallery
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue