diff options
Diffstat (limited to 'app/photos')
-rw-r--r-- | app/photos/build.py | 18 | ||||
-rw-r--r-- | app/photos/urls.py | 48 |
2 files changed, 65 insertions, 1 deletions
diff --git a/app/photos/build.py b/app/photos/build.py index b11c756..e95cbfc 100644 --- a/app/photos/build.py +++ b/app/photos/build.py @@ -2,15 +2,28 @@ import os from django.urls import reverse from builder.base import BuildNew +from .models import LuxImage + class BuildLuxPhotos(BuildNew): def build(self): self.build_detail_view() + self.build_daily_photo() def get_model_queryset(self): return self.model.objects.all() + def build_daily_photo(self): + ''' + build out images that I post daily, found by title prefix daily_ + ''' + self.build_list_view( + base_path=reverse("photos:daily_photo_list"), + qs=LuxImage.objects.filter(is_public=True, title__startswith="daily_"), + paginate_by=10 + ) + def build_detail_view(self): ''' write out all the expenses for each trip @@ -25,6 +38,11 @@ class BuildLuxPhotos(BuildNew): self.write_file(path, response.content, filename=slug) +def dailybuilder(): + j = BuildLuxPhotos("photos", "LuxImage") + j.build_daily_photo() + + def builder(): j = BuildLuxPhotos("photos", "LuxGallery") j.build() diff --git a/app/photos/urls.py b/app/photos/urls.py index cbac965..5f2a5de 100644 --- a/app/photos/urls.py +++ b/app/photos/urls.py @@ -12,7 +12,13 @@ urlpatterns = [ name="daily_photo_list" ), path( - r'data/(<str:slug>/', + r'daily/', + views.DailyPhotoList.as_view(), + {'page': 1}, + name="daily_photo_list" + ), + path( + r'data/(<str:slug>/$', views.photo_json ), re_path( @@ -25,4 +31,44 @@ urlpatterns = [ views.thumb_preview_json, name="admin_thumb_preview" ), + re_path( + r'galleries/private/(?P<slug>[-\w]+)$', + views.PrivateGallery.as_view(), + name="private" + ), + re_path( + r'galleries/private/(?P<page>\d+)/$', + views.PrivateGalleryList.as_view(), + name="private_list" + ), + re_path( + r'galleries/private/$', + RedirectView.as_view(url="/photos/galleries/private/1/", permanent=False) + ), + re_path( + r'galleries/(?P<slug>[-\w]+)$', + views.Gallery.as_view(), + name="private" + ), + re_path( + r'galleries/(?P<page>\d+)/$', + views.GalleryList.as_view(), + name="private_list" + ), + re_path( + r'galleries/$', + RedirectView.as_view(url="/photos/galleries/1/", permanent=False) + ), + re_path( + r'(?P<page>\d+)/$', + views.gallery_list, + ), + re_path( + r'(?P<slug>[-\w]+)/$', + RedirectView.as_view(url="/photos/%(slug)s/1/", permanent=False) + ), + re_path( + r'', + RedirectView.as_view(url="/photos/1/", permanent=False) + ), ] |