From 837e4fe6934c56a52cab6dcc854fa063e2de0f4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9DNyymix=E2=80=9D?= Date: Sun, 5 Jan 2025 22:34:39 +0200 Subject: [PATCH] Add photostream --- gallery/templates/gallery/photo_list.html | 16 ++++++++++++++++ gallery/urls.py | 3 +++ gallery/views.py | 5 +++++ templates/base.html | 4 ++-- 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 gallery/templates/gallery/photo_list.html diff --git a/gallery/templates/gallery/photo_list.html b/gallery/templates/gallery/photo_list.html new file mode 100644 index 0000000..19d4eb8 --- /dev/null +++ b/gallery/templates/gallery/photo_list.html @@ -0,0 +1,16 @@ +{% extends "base.html" %} + + +{% block title %} Gallery : Photostream {% endblock %} + + +{% block breadcrumb %} +
  • Photostream
  • +{% endblock %} + + +{% block content %} + {% for photo in object_list %} + {{ photo.slug }} + {% endfor %} +{% endblock %} \ No newline at end of file diff --git a/gallery/urls.py b/gallery/urls.py index 5dbd6be..6020e0b 100644 --- a/gallery/urls.py +++ b/gallery/urls.py @@ -9,6 +9,9 @@ urlpatterns = [ # Main page path('', views.Main.as_view(), name='main_url'), + # Top kuvat + path('photostream/', views.PhotosList.as_view(), name='photos_url'), + # Yksittäinen kuva albumissa: path('albums///', views.PhotoDetail.as_view(), name="photo_url"), diff --git a/gallery/views.py b/gallery/views.py index 6c4a63c..1e1358a 100644 --- a/gallery/views.py +++ b/gallery/views.py @@ -38,3 +38,8 @@ class PhotoDetail(DetailView): return get_object_or_404(Photo, slug=self.kwargs.get('photo_slug')) +class PhotosList(ListView): + model = Photo + paginate_by = 30 + + diff --git a/templates/base.html b/templates/base.html index 340e317..25a1dc3 100644 --- a/templates/base.html +++ b/templates/base.html @@ -30,7 +30,7 @@
    @@ -52,7 +52,7 @@