From bf455989d3429b9220d6fb0e9a07e9ca356be81e Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Thu, 23 Sep 2021 09:58:49 +0200 Subject: [PATCH] Show recent galleries on home page --- photo21/settings.py | 3 +++ photo21/templates/index.html | 11 ++++++++++- photo21/views.py | 7 +++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/photo21/settings.py b/photo21/settings.py index 097e5ec..01ab079 100644 --- a/photo21/settings.py +++ b/photo21/settings.py @@ -158,3 +158,6 @@ SESSION_COOKIE_AGE = 60 * 60 * 3 # Use only one Django Sites SITE_ID = 1 + +# Photologue +PHOTOLOGUE_GALLERY_SAMPLE_SIZE = 1 diff --git a/photo21/templates/index.html b/photo21/templates/index.html index 011f364..ae0b73e 100644 --- a/photo21/templates/index.html +++ b/photo21/templates/index.html @@ -13,7 +13,7 @@ SPDX-License-Identifier: GPL-3.0-or-later Kchanais.

- Les photos sont visibles dans les galeries et téléchargeables, toutefois, + Les photos sont visibles dans les galeries et téléchargeables, toutefois, l'accord de la ou du photographe et des personnes présentes sur la photo est nécessaire avant toute republication sur un autre site.

@@ -21,6 +21,15 @@ SPDX-License-Identifier: GPL-3.0-or-later Si vous souhaitez qu'une photo soit supprimée, signalez le nous : Signaler un abus +

Dernières galeries

+
+ {% for gallery in object_list %} +
+ {% include "photologue/includes/gallery_sample.html" %} +
+ {% endfor %} +
+

Nouveau venu ?

Si tu accèdes à ce service depuis le réseau du diff --git a/photo21/views.py b/photo21/views.py index 7ea9d2d..0533c20 100644 --- a/photo21/views.py +++ b/photo21/views.py @@ -2,8 +2,11 @@ # SPDX-License-Identifier: GPL-3.0-or-later from django.contrib.auth.mixins import LoginRequiredMixin -from django.views.generic import TemplateView +from django.views.generic import ListView +from photologue.models import Gallery -class IndexView(LoginRequiredMixin, TemplateView): +class IndexView(LoginRequiredMixin, ListView): + queryset = Gallery.objects.on_site().is_public() + paginate_by = 4 template_name = "index.html"