diff --git a/photo21/templates/index.html b/photo21/templates/index.html index ae0b73e..4045b1d 100644 --- a/photo21/templates/index.html +++ b/photo21/templates/index.html @@ -19,7 +19,7 @@ SPDX-License-Identifier: GPL-3.0-or-later

Si vous souhaitez qu'une photo soit supprimée, signalez le nous : - Signaler un abus + Signaler un abus

Dernières galeries

diff --git a/photo21/urls.py b/photo21/urls.py index c15ca5f..e705827 100644 --- a/photo21/urls.py +++ b/photo21/urls.py @@ -23,9 +23,11 @@ from .views import IndexView urlpatterns = [ path('', IndexView.as_view(), name='index'), path('photologue/', include('photologue.urls', namespace='photologue')), + path('photologue_custom/', include('photologue_custom.urls')), path('accounts/', include('django.contrib.auth.urls')), path('i18n/', include('django.conf.urls.i18n')), path('admin/', admin.site.urls), + path('admin/doc/', include('django.contrib.admindocs.urls')), ] if settings.DEBUG: diff --git a/photologue_custom/templates/photologue/gallery_detail.html b/photologue_custom/templates/photologue/gallery_detail.html index 368da46..729ad37 100644 --- a/photologue_custom/templates/photologue/gallery_detail.html +++ b/photologue_custom/templates/photologue/gallery_detail.html @@ -26,7 +26,7 @@ {% if gallery.extended.tags.all %}

Tags : {% for tag in gallery.extended.tags.all %} - {{ tag }} + {{ tag }} {% endfor %}

{% endif %} diff --git a/photologue_custom/templates/taggit/tag_detail.html b/photologue_custom/templates/taggit/tag_detail.html new file mode 100644 index 0000000..5580877 --- /dev/null +++ b/photologue_custom/templates/taggit/tag_detail.html @@ -0,0 +1,16 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block title %}{{ object.name }}{% endblock %} + +{% block content %} +

Tag : {{ object.name }}

+ +
+ {% for gallery in galleries %} +
+ {% include "photologue/includes/gallery_sample.html" %} +
+ {% endfor %} +
+{% endblock %} diff --git a/photologue_custom/urls.py b/photologue_custom/urls.py new file mode 100644 index 0000000..741b84c --- /dev/null +++ b/photologue_custom/urls.py @@ -0,0 +1,7 @@ +from django.urls import path + +from .views import TagDetail + +urlpatterns = [ + path('tags//', TagDetail.as_view(), name='tag-detail'), +] diff --git a/photologue_custom/views.py b/photologue_custom/views.py index e69de29..647137b 100644 --- a/photologue_custom/views.py +++ b/photologue_custom/views.py @@ -0,0 +1,21 @@ +# Copyright (C) 2021 by BDE ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later + +from django.contrib.auth.mixins import LoginRequiredMixin +from django.views.generic import DetailView +from taggit.models import Tag +from photologue.models import Gallery + + +class TagDetail(LoginRequiredMixin, DetailView): + model = Tag + + def get_context_data(self, **kwargs): + """ + Insert the single object into the context dict. + """ + current_tag = self.get_object().slug + context = super().get_context_data(**kwargs) + context['galleries'] = Gallery.objects.on_site().is_public() \ + .filter(extended__tags__name=current_tag) + return context