From 5d9d89a9cb4a9b158f9dffa8125a39c3a7b864e8 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Tue, 12 Oct 2021 23:26:16 +0200 Subject: [PATCH 01/19] Use autocomplete on photos in gallery --- photologue_custom/admin.py | 1 + 1 file changed, 1 insertion(+) diff --git a/photologue_custom/admin.py b/photologue_custom/admin.py index 2c0aca0..936f7e9 100644 --- a/photologue_custom/admin.py +++ b/photologue_custom/admin.py @@ -17,6 +17,7 @@ class GalleryAdmin(GalleryAdminDefault): model. """ inlines = [GalleryExtendedInline, ] + autocomplete_fields = ['photos', ] class PhotoExtendedInline(admin.StackedInline): From 227d4fa2466f2bdd2f85f1445a45e58babfc8a58 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Tue, 12 Oct 2021 23:26:54 +0200 Subject: [PATCH 02/19] Show event date rather than publication date --- photologue_custom/templates/photologue/gallery_detail.html | 2 +- .../templates/photologue/includes/gallery_sample.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/photologue_custom/templates/photologue/gallery_detail.html b/photologue_custom/templates/photologue/gallery_detail.html index 03415cb..61b3727 100644 --- a/photologue_custom/templates/photologue/gallery_detail.html +++ b/photologue_custom/templates/photologue/gallery_detail.html @@ -22,7 +22,7 @@ {% block content %}

{{ gallery.title }}

-

{% trans "Published" %} {{ gallery.date_added|date }}

+{% if gallery.extended.date_start %}

{{ gallery.extended.date_start }}{% if gallery.extended.date_end and gallery.extended.date_end != gallery.extended.date_start %} {% trans "to" %} {{ gallery.extended.date_end }}{% endif %}

{% endif %} {% if gallery.extended.tags.all %}

Tags : {% for tag in gallery.extended.tags.all %} diff --git a/photologue_custom/templates/photologue/includes/gallery_sample.html b/photologue_custom/templates/photologue/includes/gallery_sample.html index 34d53a8..2b485d6 100644 --- a/photologue_custom/templates/photologue/includes/gallery_sample.html +++ b/photologue_custom/templates/photologue/includes/gallery_sample.html @@ -6,8 +6,8 @@ {% endfor %}

{{ gallery.title }}
-

{% trans "Published" %} {{ gallery.date_added|date }}

+ {% if gallery.extended.date_start %}

{{ gallery.extended.date_start }}{% if gallery.extended.date_end and gallery.extended.date_end != gallery.extended.date_start %} - {{ gallery.extended.date_end }}{% endif %}

{% endif %} {% if gallery.description %}

{{ gallery.description|safe }}

{% endif %}
- \ No newline at end of file + From c71427a2dffb9028748eb086ed30c50e0bcd7c94 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Tue, 12 Oct 2021 23:27:08 +0200 Subject: [PATCH 03/19] Show owner name in legend of photo --- photologue_custom/templates/photologue/gallery_detail.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/photologue_custom/templates/photologue/gallery_detail.html b/photologue_custom/templates/photologue/gallery_detail.html index 61b3727..182b8e0 100644 --- a/photologue_custom/templates/photologue/gallery_detail.html +++ b/photologue_custom/templates/photologue/gallery_detail.html @@ -34,7 +34,7 @@ From 07eaafe5ebd130fe9439646e787169209c3598ec Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Tue, 12 Oct 2021 23:36:02 +0200 Subject: [PATCH 04/19] Update translations --- photo21/locale/fr/LC_MESSAGES/django.po | 42 +++++++++++++++++++------ 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/photo21/locale/fr/LC_MESSAGES/django.po b/photo21/locale/fr/LC_MESSAGES/django.po index cc9f517..52bfecf 100644 --- a/photo21/locale/fr/LC_MESSAGES/django.po +++ b/photo21/locale/fr/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-11 18:38+0000\n" +"POT-Creation-Date: 2021-10-12 21:35+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -30,19 +30,31 @@ msgstr "" msgid "Must end with `@crans.org` or `@ens-paris-saclay.fr`." msgstr "Doit finir par `@crans.org` ou `@ens-paris-saclay.fr`." -#: photo21/settings.py:143 +#: photo21/hashers.py:42 +msgid "algorithm" +msgstr "" + +#: photo21/hashers.py:43 +msgid "salt" +msgstr "" + +#: photo21/hashers.py:44 +msgid "hash" +msgstr "" + +#: photo21/settings.py:153 msgid "German" msgstr "" -#: photo21/settings.py:144 +#: photo21/settings.py:154 msgid "English" msgstr "" -#: photo21/settings.py:145 +#: photo21/settings.py:155 msgid "Spanish" msgstr "" -#: photo21/settings.py:146 +#: photo21/settings.py:156 msgid "French" msgstr "" @@ -174,7 +186,15 @@ msgstr "Inscription" msgid "Connected as" msgstr "Connecté en tant que" -#: photologue_custom/models.py:39 +#: photologue_custom/models.py:23 +msgid "start date" +msgstr "date de début" + +#: photologue_custom/models.py:28 +msgid "end date" +msgstr "date de fin" + +#: photologue_custom/models.py:51 msgid "owner" msgstr "propriétaire" @@ -206,15 +226,17 @@ msgid "No galleries were found." msgstr "" #: photologue_custom/templates/photologue/gallery_detail.html:25 -#: photologue_custom/templates/photologue/includes/gallery_sample.html:9 -#: photologue_custom/templates/photologue/photo_detail.html:10 -msgid "Published" -msgstr "" +msgid "to" +msgstr "au" #: photologue_custom/templates/photologue/gallery_detail.html:41 msgid "Download all gallery" msgstr "Télécharger toute la galerie" +#: photologue_custom/templates/photologue/photo_detail.html:10 +msgid "Published" +msgstr "" + #: photologue_custom/templates/photologue/photo_detail.html:22 msgid "This photo is found in the following galleries" msgstr "" From f4c2ac5df25160d68dad1656ce190829f9257155 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 13 Oct 2021 07:02:24 +0200 Subject: [PATCH 05/19] Update index content --- photo21/templates/index.html | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/photo21/templates/index.html b/photo21/templates/index.html index 4045b1d..63be33d 100644 --- a/photo21/templates/index.html +++ b/photo21/templates/index.html @@ -18,8 +18,14 @@ SPDX-License-Identifier: GPL-3.0-or-later photo est nécessaire avant toute republication sur un autre site.

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

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

+

+ Si vous souhaitez obtenir les droits photographes pour téléverser vos photos, signalez le nous : + Devenir photographe +

Dernières galeries

@@ -30,18 +36,9 @@ SPDX-License-Identifier: GPL-3.0-or-later {% endfor %}
-

Nouveau venu ?

-

- Si tu accèdes à ce service depuis le réseau du - Crans, tu peux naviguer sur le - serveur comme tu le souhaites. - Par contre dès que tu essairas d'accéder au serveur photos depuis une - connexion Internet externe tu devras te créer un compte utilisateur. -

-

Participez et faites vivre le serveur photos :

    -
  • Devenez photographe en vous créant un compte ou en upgradant votre compte utilisateur
  • +
  • Devenez photographe et téléversez vos photos
  • Reportez-nous toute anomalie dans la nouvelle interface ou toute difficulté rencontrée : fautes d'orthographes, bugs, mauvaise ergonomie…
  • Envoyez-nous vos suggestions à photos@crans.org.
  • Si l'amélioration ou la gestion du serveur vous intéresse et pour en savoir plus, contactez-nous.
  • @@ -66,4 +63,4 @@ SPDX-License-Identifier: GPL-3.0-or-later -{% endblock %} \ No newline at end of file +{% endblock %} From a65327f309d57068c7d37ecb6de7070e78984669 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 13 Oct 2021 10:11:09 +0200 Subject: [PATCH 06/19] Add backup script --- docs/backup-photos | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 docs/backup-photos diff --git a/docs/backup-photos b/docs/backup-photos new file mode 100644 index 0000000..9f00d93 --- /dev/null +++ b/docs/backup-photos @@ -0,0 +1,4 @@ +#!/bin/sh +# Backup script to put in /etc/cron.montly/ +rsync -avP /var/www/photos/photo21 /backup/ +sudo -u postgres pg_dump photo21 > /backup/pg_dump_photo21.sql From 313091319111a15a583c596aa91921a82b484768 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 13 Oct 2021 10:49:04 +0200 Subject: [PATCH 07/19] Customize account views --- photo21/templates/account/email.html | 79 +++++++++++++++++++ .../templates/socialaccount/connections.html | 66 ++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 photo21/templates/account/email.html create mode 100644 photo21/templates/socialaccount/connections.html diff --git a/photo21/templates/account/email.html b/photo21/templates/account/email.html new file mode 100644 index 0000000..d7c472f --- /dev/null +++ b/photo21/templates/account/email.html @@ -0,0 +1,79 @@ +{% extends "account/base.html" %} +{% comment %} +SPDX-License-Identifier: GPL-2.0-or-later +{% endcomment %} +{% load i18n crispy_forms_tags %} +{% block head_title %}{% trans "E-mail Addresses" %}{% endblock %} + +{% block content %} +

    {% trans "Account" %}

    +
    + +
    + {% if user.emailaddress_set.all %} +

    {% trans 'The following e-mail addresses are associated with your account:' %}

    + + + {% else %} +

    {% trans 'Warning:'%} {% trans "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %}

    + {% endif %} + + {% if can_add_email %} +

    {% trans "Add E-mail Address" %}

    + +
    + {% csrf_token %} + {{ form|crispy }} + +
    + {% endif %} +
    +
    + + +{% endblock %} diff --git a/photo21/templates/socialaccount/connections.html b/photo21/templates/socialaccount/connections.html new file mode 100644 index 0000000..ff3a221 --- /dev/null +++ b/photo21/templates/socialaccount/connections.html @@ -0,0 +1,66 @@ +{% extends "socialaccount/base.html" %} +{% comment %} +SPDX-License-Identifier: GPL-2.0-or-later +{% endcomment %} +{% load i18n %} +{% block head_title %}{% trans "Account Connections" %}{% endblock %} + +{% block content %} +

    {% trans "Account" %}

    +
    + +
    + {% if form.accounts %} +

    {% blocktrans %}You can sign in to your account using any of the following third party accounts:{% endblocktrans %}

    + +
    + {% csrf_token %} +
    + {% if form.non_field_errors %} +
    {{ form.non_field_errors }}
    + {% endif %} + + {% for base_account in form.accounts %} + {% with base_account.get_provider_account as account %} +
    + +
    + {% endwith %} + {% endfor %} + +
    + +
    +
    +
    + + {% else %} +

    {% trans 'You currently have no social network accounts connected to this account.' %}

    + {% endif %} + +

    {% trans 'Add a 3rd Party Account' %}

    + +
      + {% include "socialaccount/snippets/provider_list.html" with process="connect" %} +
    + + {% include "socialaccount/snippets/login_extra.html" %} +
    +
    + + + +{% endblock %} From dd5409d93ece898952741d08cb2c105c2c115da7 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 13 Oct 2021 11:23:58 +0200 Subject: [PATCH 08/19] Filter on event date in galleries list --- photologue_custom/urls.py | 7 +++++-- photologue_custom/views.py | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/photologue_custom/urls.py b/photologue_custom/urls.py index 1401caf..52fc483 100644 --- a/photologue_custom/urls.py +++ b/photologue_custom/urls.py @@ -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//', TagDetail.as_view(), name='tag-detail'), + path('gallery/', CustomGalleryArchiveIndexView.as_view(), name='pl-gallery-archive'), + re_path(r'^gallery/(?P\d{4})/$', CustomGalleryYearArchiveView.as_view(), name='pl-gallery-archive-year'), path('gallery//download/', GalleryDownload.as_view(), name='gallery-download'), ] diff --git a/photologue_custom/views.py b/photologue_custom/views.py index cea94e7..285ae5e 100644 --- a/photologue_custom/views.py +++ b/photologue_custom/views.py @@ -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 From c02d639bbb457c38d1c4746e6efe5c381e5373c1 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 13 Oct 2021 14:08:50 +0200 Subject: [PATCH 09/19] Search on galleries title --- photologue_custom/admin.py | 1 + 1 file changed, 1 insertion(+) diff --git a/photologue_custom/admin.py b/photologue_custom/admin.py index 936f7e9..909117d 100644 --- a/photologue_custom/admin.py +++ b/photologue_custom/admin.py @@ -18,6 +18,7 @@ class GalleryAdmin(GalleryAdminDefault): """ inlines = [GalleryExtendedInline, ] autocomplete_fields = ['photos', ] + search_fields = ['title', ] class PhotoExtendedInline(admin.StackedInline): From 292f8e629826b4b9b94624a2a2041b46dbc0b407 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 13 Oct 2021 14:14:09 +0200 Subject: [PATCH 10/19] Allow more fields in URL --- photo21/settings.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/photo21/settings.py b/photo21/settings.py index f5aaaa0..08250a8 100644 --- a/photo21/settings.py +++ b/photo21/settings.py @@ -156,6 +156,9 @@ LANGUAGES = [ ('fr', _('French')), ] +# Allow more fields in URL to edit large galleries +DATA_UPLOAD_MAX_NUMBER_FIELDS = 10240 + # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.2/howto/static-files/ From 5985b39ed8ddc3ebd94d91736144d0aa5761b984 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 13 Oct 2021 14:19:04 +0200 Subject: [PATCH 11/19] Fix tag display page --- photologue_custom/templates/photologue/gallery_detail.html | 2 +- photologue_custom/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/photologue_custom/templates/photologue/gallery_detail.html b/photologue_custom/templates/photologue/gallery_detail.html index 182b8e0..8c8692d 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/views.py b/photologue_custom/views.py index 285ae5e..0a29748 100644 --- a/photologue_custom/views.py +++ b/photologue_custom/views.py @@ -23,7 +23,7 @@ class TagDetail(LoginRequiredMixin, DetailView): 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) + .filter(extended__tags__slug=current_tag) return context From d6a8a2b68e14f39d06148db359dc4b9cfcf14761 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 13 Oct 2021 14:25:11 +0200 Subject: [PATCH 12/19] Use a smaller grid on smaller screen --- photologue_custom/templates/photologue/gallery_archive.html | 2 +- .../templates/photologue/gallery_archive_year.html | 2 +- photologue_custom/templates/taggit/tag_detail.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/photologue_custom/templates/photologue/gallery_archive.html b/photologue_custom/templates/photologue/gallery_archive.html index babfaeb..c3571cb 100644 --- a/photologue_custom/templates/photologue/gallery_archive.html +++ b/photologue_custom/templates/photologue/gallery_archive.html @@ -23,7 +23,7 @@ {% if latest %}
    {% for gallery in latest|slice:":32" %} -
    +
    {% include "photologue/includes/gallery_sample.html" %}
    {% endfor %} diff --git a/photologue_custom/templates/photologue/gallery_archive_year.html b/photologue_custom/templates/photologue/gallery_archive_year.html index 84f535c..44b1e3c 100644 --- a/photologue_custom/templates/photologue/gallery_archive_year.html +++ b/photologue_custom/templates/photologue/gallery_archive_year.html @@ -17,7 +17,7 @@ {% if object_list %}
    {% for gallery in object_list %} -
    +
    {% include "photologue/includes/gallery_sample.html" %}
    {% endfor %} diff --git a/photologue_custom/templates/taggit/tag_detail.html b/photologue_custom/templates/taggit/tag_detail.html index 5580877..1484f2e 100644 --- a/photologue_custom/templates/taggit/tag_detail.html +++ b/photologue_custom/templates/taggit/tag_detail.html @@ -8,7 +8,7 @@
    {% for gallery in galleries %} -
    +
    {% include "photologue/includes/gallery_sample.html" %}
    {% endfor %} From ac75442c849021e125a06d973c9670cdd0e7eed9 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 13 Oct 2021 15:51:47 +0200 Subject: [PATCH 13/19] Set account link active when visiting --- photo21/templates/base.html | 3 ++- photo21/templates/socialaccount/connections.html | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/photo21/templates/base.html b/photo21/templates/base.html index 97ecbb8..7d09a26 100644 --- a/photo21/templates/base.html +++ b/photo21/templates/base.html @@ -43,7 +43,8 @@ SPDX-License-Identifier: GPL-3.0-or-later
    - - - {% endblock %} From b3c85f15e520eda676500f7d4886b477b2bd633e Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 13 Oct 2021 15:52:03 +0200 Subject: [PATCH 14/19] Add gallery management link --- .../templates/photologue/gallery_detail.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/photologue_custom/templates/photologue/gallery_detail.html b/photologue_custom/templates/photologue/gallery_detail.html index 8c8692d..d15fa41 100644 --- a/photologue_custom/templates/photologue/gallery_detail.html +++ b/photologue_custom/templates/photologue/gallery_detail.html @@ -21,7 +21,17 @@ {% endblock %} {% block content %} -

    {{ gallery.title }}

    +

    + {{ gallery.title }} + {% if request.user.is_staff and perms.photologue.change_gallery %} + + + + + + + {% endif %} +

    {% if gallery.extended.date_start %}

    {{ gallery.extended.date_start }}{% if gallery.extended.date_end and gallery.extended.date_end != gallery.extended.date_start %} {% trans "to" %} {{ gallery.extended.date_end }}{% endif %}

    {% endif %} {% if gallery.extended.tags.all %}

    From 2753f70234d89928afb42292ae070000a72ace84 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 13 Oct 2021 15:52:18 +0200 Subject: [PATCH 15/19] Show gallery in a card --- .../templates/photologue/gallery_detail.html | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/photologue_custom/templates/photologue/gallery_detail.html b/photologue_custom/templates/photologue/gallery_detail.html index d15fa41..9a747c3 100644 --- a/photologue_custom/templates/photologue/gallery_detail.html +++ b/photologue_custom/templates/photologue/gallery_detail.html @@ -41,12 +41,26 @@

    {% endif %} {% if gallery.description %}

    {{ gallery.description|safe }}

    {% endif %} -