From 55e1b71f3a6804b599df1657e3a10e1601c3cb42 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss <erdnaxe@crans.org> Date: Fri, 22 Oct 2021 18:06:31 +0200 Subject: [PATCH 1/2] Add license field on photos --- photo21/locale/fr/LC_MESSAGES/django.po | 6 +++++- .../migrations/0004_photoextended_license.py | 18 ++++++++++++++++++ photologue_custom/models.py | 5 +++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 photologue_custom/migrations/0004_photoextended_license.py diff --git a/photo21/locale/fr/LC_MESSAGES/django.po b/photo21/locale/fr/LC_MESSAGES/django.po index 3f8956a..18d2014 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-15 12:15+0000\n" +"POT-Creation-Date: 2021-10-22 16:05+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -317,6 +317,10 @@ msgstr "date de début" msgid "end date" msgstr "date de fin" +#: photologue_custom/models.py:56 +msgid "license" +msgstr "licence" + #: photologue_custom/templates/photologue/gallery_archive.html:7 #: photologue_custom/templates/photologue/gallery_archive.html:12 msgid "Latest photo galleries" diff --git a/photologue_custom/migrations/0004_photoextended_license.py b/photologue_custom/migrations/0004_photoextended_license.py new file mode 100644 index 0000000..87c6887 --- /dev/null +++ b/photologue_custom/migrations/0004_photoextended_license.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.24 on 2021-10-22 16:04 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('photologue_custom', '0003_auto_20211013_1507'), + ] + + operations = [ + migrations.AddField( + model_name='photoextended', + name='license', + field=models.CharField(blank=True, max_length=255, verbose_name='license'), + ), + ] diff --git a/photologue_custom/models.py b/photologue_custom/models.py index 09e2765..6275e64 100644 --- a/photologue_custom/models.py +++ b/photologue_custom/models.py @@ -50,6 +50,11 @@ class PhotoExtended(models.Model): on_delete=models.CASCADE, verbose_name=_("owner"), ) + license = models.CharField( + max_length=255, + blank=True, + verbose_name=_("license"), + ) class Meta: verbose_name = 'Extra fields' -- GitLab From 1d3a5a30d2375cb7ee233209ec7c653479834706 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss <erdnaxe@crans.org> Date: Fri, 22 Oct 2021 18:09:00 +0200 Subject: [PATCH 2/2] Show license in gallery view --- 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 1a24121..15c0b32 100644 --- a/photologue_custom/templates/photologue/gallery_detail.html +++ b/photologue_custom/templates/photologue/gallery_detail.html @@ -67,7 +67,7 @@ SPDX-License-Identifier: GPL-3.0-or-later <div class="card-body row" id="lightgallery"> {% for photo in photos %} <a class="col-6 col-md-3 mb-2 text-center" href="{{ photo.get_absolute_url }}" data-src="{{ photo.get_display_url }}" data-download-url="{{ photo.image.url }}"> - <img src="{{ photo.get_thumbnail_url }}" class="img-thumbnail" alt="{{ photo.title }}{% if photo.date_taken %} - {{ photo.date_taken|date }} {{ photo.date_taken|time }}{% endif %} - {{ photo.extended.owner.get_full_name }}"> + <img src="{{ photo.get_thumbnail_url }}" class="img-thumbnail" alt="{{ photo.title }}{% if photo.date_taken %} - {{ photo.date_taken|date }} {{ photo.date_taken|time }}{% endif %} - {{ photo.extended.owner.get_full_name }}{% if photo.extended.license %} - {{ photo.extended.license }}{% endif %}"> </a> {% endfor %} </div> -- GitLab