diff --git a/docs/changelog.rst b/docs/changelog.rst index 416d28c4..8440447e 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -7,6 +7,7 @@ CHANGELOG **Enhancement** +* Add contributions validated and publication date * Add contributions type / category filters * Add contributions manager * Add contribution status diff --git a/georiviere/contribution/filters.py b/georiviere/contribution/filters.py index 92de3afe..5589f4f1 100644 --- a/georiviere/contribution/filters.py +++ b/georiviere/contribution/filters.py @@ -70,5 +70,5 @@ class ContributionFilterSet(WatershedFilterSet, ZoningFilterSet, MapEntityFilter class Meta(MapEntityFilterSet.Meta): model = Contribution fields = MapEntityFilterSet.Meta.fields + [ - "category_contribution", "type_contribution", 'status_contribution', 'assigned_user' + "category_contribution", "type_contribution", 'status_contribution', 'assigned_user', "validated" ] diff --git a/georiviere/contribution/forms.py b/georiviere/contribution/forms.py index 1fec349c..847541ca 100644 --- a/georiviere/contribution/forms.py +++ b/georiviere/contribution/forms.py @@ -14,16 +14,17 @@ class ContributionForm(CommonForm): "description", "severity", "published", + "validated" "portal", "email_author", "assigned_user", - "status_contribution" + "status_contribution", ) ] class Meta(CommonForm): fields = ["description", "severity", "published", "portal", "email_author", "geom", "assigned_user", - "status_contribution"] + "status_contribution", "validated"] model = Contribution def __init__(self, *args, **kwargs): diff --git a/georiviere/contribution/locale/en/LC_MESSAGES/django.po b/georiviere/contribution/locale/en/LC_MESSAGES/django.po index f009e90e..154e2469 100644 --- a/georiviere/contribution/locale/en/LC_MESSAGES/django.po +++ b/georiviere/contribution/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-24 12:00+0000\n" +"POT-Creation-Date: 2023-07-25 12:41+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -51,6 +51,9 @@ msgstr "" msgid "Severity types" msgstr "" +msgid "Status" +msgstr "" + msgid "Name author" msgstr "" @@ -72,13 +75,16 @@ msgstr "" msgid "Description of the contribution" msgstr "" -msgid "Published" +msgid "Portal" msgstr "" -msgid "Make it visible on portal" +msgid "Supervisor" msgstr "" -msgid "Portal" +msgid "Validated" +msgstr "" + +msgid "Validate the contribution" msgstr "" msgid "Contributions" @@ -90,6 +96,9 @@ msgstr "" msgid "No category" msgstr "" +msgid "Published" +msgstr "" + msgid "Contribution potential damage type" msgstr "" @@ -281,9 +290,6 @@ msgstr "" msgid "Stream" msgstr "" -msgid "Status" -msgstr "" - msgid "Morphologies" msgstr "" diff --git a/georiviere/contribution/locale/fr/LC_MESSAGES/django.po b/georiviere/contribution/locale/fr/LC_MESSAGES/django.po index a7d87450..6115749a 100644 --- a/georiviere/contribution/locale/fr/LC_MESSAGES/django.po +++ b/georiviere/contribution/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: 2023-07-24 12:00+0000\n" +"POT-Creation-Date: 2023-07-25 12:41+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -51,6 +51,9 @@ msgstr "Type de gravité" msgid "Severity types" msgstr "Types de gravité" +msgid "Status" +msgstr "Status" + msgid "Name author" msgstr "Nom de l'auteur" @@ -72,15 +75,18 @@ msgstr "Description" msgid "Description of the contribution" msgstr "Description de la gravité" -msgid "Published" -msgstr "Publier" - -msgid "Make it visible on portal" -msgstr "Rendre visible sur le portail" - msgid "Portal" msgstr "Portail" +msgid "Supervisor" +msgstr "Superviseur" + +msgid "Validated" +msgstr "Validé" + +msgid "Validate the contribution" +msgstr "Valider la contribution" + msgid "Contributions" msgstr "Contributions" @@ -90,6 +96,9 @@ msgstr "Nom" msgid "No category" msgstr "Aucune catégorie" +msgid "Published" +msgstr "Publié" + msgid "Contribution potential damage type" msgstr "Type de contibution dégats potentiels" @@ -281,9 +290,6 @@ msgstr "Contributions éléments paysagers" msgid "Stream" msgstr "Rivière" -msgid "Status" -msgstr "Status" - msgid "Morphologies" msgstr "Morphologies" diff --git a/georiviere/contribution/migrations/0005_contribution_validated.py b/georiviere/contribution/migrations/0005_contribution_validated.py new file mode 100644 index 00000000..7d0eb967 --- /dev/null +++ b/georiviere/contribution/migrations/0005_contribution_validated.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.14 on 2023-07-25 12:12 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('contribution', '0004_auto_20230724_1502'), + ] + + operations = [ + migrations.AddField( + model_name='contribution', + name='validated', + field=models.BooleanField(default=False, help_text='Validate the contribution', verbose_name='Validated'), + ), + ] diff --git a/georiviere/contribution/migrations/0006_contribution_publication_date.py b/georiviere/contribution/migrations/0006_contribution_publication_date.py new file mode 100644 index 00000000..dfd2168e --- /dev/null +++ b/georiviere/contribution/migrations/0006_contribution_publication_date.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.14 on 2023-07-25 12:52 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('contribution', '0005_contribution_validated'), + ] + + operations = [ + migrations.AddField( + model_name='contribution', + name='publication_date', + field=models.DateField(blank=True, editable=False, null=True, verbose_name='Publication date'), + ), + ] diff --git a/georiviere/contribution/models.py b/georiviere/contribution/models.py index ec86d77f..58768973 100644 --- a/georiviere/contribution/models.py +++ b/georiviere/contribution/models.py @@ -5,7 +5,7 @@ from mapentity.models import MapEntityMixin -from geotrek.common.mixins import TimeStampedModelMixin +from geotrek.common.mixins import TimeStampedModelMixin, BasePublishableMixin from geotrek.common.utils import classproperty from geotrek.zoning.mixins import ZoningPropertiesMixin @@ -58,7 +58,7 @@ def status_default(): return None -class Contribution(TimeStampedModelMixin, WatershedPropertiesMixin, ZoningPropertiesMixin, +class Contribution(BasePublishableMixin, TimeStampedModelMixin, WatershedPropertiesMixin, ZoningPropertiesMixin, AddPropertyBufferMixin, MapEntityMixin): """contribution model""" geom = models.GeometryField(srid=settings.SRID, spatial_index=True) @@ -91,6 +91,8 @@ class Contribution(TimeStampedModelMixin, WatershedPropertiesMixin, ZoningProper default=status_default, verbose_name=_("Status"), ) + validated = models.BooleanField(verbose_name=_("Validated"), default=False, + help_text=_("Validate the contribution")) class Meta: verbose_name = _("Contribution") diff --git a/georiviere/contribution/templates/contribution/contribution_detail_attributes.html b/georiviere/contribution/templates/contribution/contribution_detail_attributes.html index 09ed6269..90efab1a 100644 --- a/georiviere/contribution/templates/contribution/contribution_detail_attributes.html +++ b/georiviere/contribution/templates/contribution/contribution_detail_attributes.html @@ -170,6 +170,7 @@ {% endif %} {% include "mapentity/trackinfo_fragment.html" %} + {% include "main/publication_info_fragment.html" %} {{ block.super }} {% endblock attributes %} diff --git a/georiviere/contribution/tests/test_views.py b/georiviere/contribution/tests/test_views.py index a604d3bb..91bf4560 100644 --- a/georiviere/contribution/tests/test_views.py +++ b/georiviere/contribution/tests/test_views.py @@ -23,7 +23,9 @@ def get_expected_json_attrs(self): 'geom': self.obj.geom.ewkt, 'portal': self.obj.portal.pk, 'published': False, - 'status_contribution': self.obj.status_contribution + 'status_contribution': self.obj.status_contribution, + 'validated': False, + 'publication_date': self.obj.publication_date, } def get_good_data(self): diff --git a/georiviere/main/locale/en/LC_MESSAGES/django.po b/georiviere/main/locale/en/LC_MESSAGES/django.po index 323844e6..8b59f966 100644 --- a/georiviere/main/locale/en/LC_MESSAGES/django.po +++ b/georiviere/main/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-23 17:11+0000\n" +"POT-Creation-Date: 2023-07-25 12:42+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -24,6 +24,12 @@ msgstr "" msgid "Restricted area" msgstr "" +msgid "Creator" +msgstr "" + +msgid "User that uploaded" +msgstr "" + msgid "Name" msgstr "" @@ -33,8 +39,77 @@ msgstr "" msgid "Data sources" msgstr "" +msgid "Distance" +msgstr "" + +msgid "Distance to source" +msgstr "" + +msgid "Distance to sources" +msgstr "" + +msgid "List" +msgstr "" + +msgid "Quick access" +msgstr "" + +msgid "Add" +msgstr "" + +msgid "Admin" +msgstr "" + +msgid "Logbook" +msgstr "" + +msgid "Logout" +msgstr "" + msgid "None" msgstr "" -msgid "Visible on Geotrek-rando" -msgstr "Visible on Georiviere" +msgid "Display report" +msgstr "" + +#, python-format +msgid "%(n)s/%(nb_lines)s line imported." +msgid_plural "%(n)s/%(nb_lines)s lines imported." +msgstr[0] "" +msgstr[1] "" + +#, python-format +msgid "%(n)s record created." +msgid_plural "%(n)s records created." +msgstr[0] "" +msgstr[1] "" + +#, python-format +msgid "%(n)s record updated." +msgid_plural "%(n)s records updated." +msgstr[0] "" +msgstr[1] "" + +#, python-format +msgid "%(n)s record deleted." +msgid_plural "%(n)s records deleted." +msgstr[0] "" +msgstr[1] "" + +#, python-format +msgid "%(n)s record unmodified." +msgid_plural "%(n)s records unmodified." +msgstr[0] "" +msgstr[1] "" + +#, python-format +msgid "%(n)s warning:" +msgid_plural "%(n)s warnings:" +msgstr[0] "" +msgstr[1] "" + +msgid "Waiting for publication" +msgstr "" + +msgid "Draft" +msgstr "" diff --git a/georiviere/main/locale/fr/LC_MESSAGES/django.po b/georiviere/main/locale/fr/LC_MESSAGES/django.po index 79d44856..f80ef8c5 100644 --- a/georiviere/main/locale/fr/LC_MESSAGES/django.po +++ b/georiviere/main/locale/fr/LC_MESSAGES/django.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-23 17:11+0000\n" +"POT-Creation-Date: 2023-07-25 12:42+0000\n" "PO-Revision-Date: 2021-11-23 15:31+0000\n" "Last-Translator: Jean-Etienne Castagnede , 2021\n" "Language-Team: French (https://www.transifex.com/georiviere/teams/128005/" @@ -28,6 +28,12 @@ msgstr "Principal" msgid "Restricted area" msgstr "Zone réglementaire" +msgid "Creator" +msgstr "Créateur" + +msgid "User that uploaded" +msgstr "Utilisateur qui a téléverser" + msgid "Name" msgstr "Nom" @@ -37,8 +43,77 @@ msgstr "Source de données" msgid "Data sources" msgstr "Sources de données" +msgid "Distance" +msgstr "Distance" + +msgid "Distance to source" +msgstr "Distance à la source" + +msgid "Distance to sources" +msgstr "Distance aux sources" + +msgid "List" +msgstr "Liste" + +msgid "Quick access" +msgstr "Accès rapide" + +msgid "Add" +msgstr "Ajouter" + +msgid "Admin" +msgstr "Admin" + +msgid "Logbook" +msgstr "Registre" + +msgid "Logout" +msgstr "Se déconnecter" + msgid "None" msgstr "Aucun(e)" -msgid "Visible on Geotrek-rando" -msgstr "Visible sur Georivière" +msgid "Display report" +msgstr "Afficher le rapport" + +#, python-format +msgid "%(n)s/%(nb_lines)s line imported." +msgid_plural "%(n)s/%(nb_lines)s lines imported." +msgstr[0] "" +msgstr[1] "" + +#, python-format +msgid "%(n)s record created." +msgid_plural "%(n)s records created." +msgstr[0] "" +msgstr[1] "" + +#, python-format +msgid "%(n)s record updated." +msgid_plural "%(n)s records updated." +msgstr[0] "" +msgstr[1] "" + +#, python-format +msgid "%(n)s record deleted." +msgid_plural "%(n)s records deleted." +msgstr[0] "" +msgstr[1] "" + +#, python-format +msgid "%(n)s record unmodified." +msgid_plural "%(n)s records unmodified." +msgstr[0] "" +msgstr[1] "" + +#, python-format +msgid "%(n)s warning:" +msgid_plural "%(n)s warnings:" +msgstr[0] "" +msgstr[1] "" + +msgid "Waiting for publication" +msgstr "En attente pour publication" + +msgid "Draft" +msgstr "Brouillon" diff --git a/georiviere/main/templates/main/publication_info_fragment.html b/georiviere/main/templates/main/publication_info_fragment.html index 79d67252..35378c36 100644 --- a/georiviere/main/templates/main/publication_info_fragment.html +++ b/georiviere/main/templates/main/publication_info_fragment.html @@ -12,7 +12,8 @@ {% endif %} {% endfor %} - ({{ object|verbose:"publication_date" }}: {{ object.publication_date }}) + {% if object.publication_date %}({{ object|verbose:"publication_date" }}: {{ object.publication_date }}) + {% endif %} {% else %} {% if object.review %} {% trans "Waiting for publication" %} diff --git a/georiviere/settings/__init__.py b/georiviere/settings/__init__.py index 95008093..d7fe93c0 100644 --- a/georiviere/settings/__init__.py +++ b/georiviere/settings/__init__.py @@ -430,6 +430,10 @@ def construct_relative_path_mock(current_template_name, relative_name): PARSER_NUMBER_OF_TRIES = 3 # number of requests to try before abandon PARSER_RETRY_HTTP_STATUS = [503] +# Publication + +PUBLISHED_BY_LANG = False + # Thumbnails THUMBNAIL_ALIASES = {