Skip to content

Commit

Permalink
Merge pull request #198 from Georiviere/feat_addvalidated_publication…
Browse files Browse the repository at this point in the history
…_date

Feat addvalidated publication date
  • Loading branch information
LePetitTim authored Jul 25, 2023
2 parents 3d3b186 + 4c9e5c1 commit af6a941
Show file tree
Hide file tree
Showing 14 changed files with 240 additions and 30 deletions.
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CHANGELOG

**Enhancement**

* Add contributions validated and publication date
* Add contributions type / category filters
* Add contributions manager
* Add contribution status
Expand Down
2 changes: 1 addition & 1 deletion georiviere/contribution/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
5 changes: 3 additions & 2 deletions georiviere/contribution/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
20 changes: 13 additions & 7 deletions georiviere/contribution/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -51,6 +51,9 @@ msgstr ""
msgid "Severity types"
msgstr ""

msgid "Status"
msgstr ""

msgid "Name author"
msgstr ""

Expand All @@ -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"
Expand All @@ -90,6 +96,9 @@ msgstr ""
msgid "No category"
msgstr ""

msgid "Published"
msgstr ""

msgid "Contribution potential damage type"
msgstr ""

Expand Down Expand Up @@ -281,9 +290,6 @@ msgstr ""
msgid "Stream"
msgstr ""

msgid "Status"
msgstr ""

msgid "Morphologies"
msgstr ""

Expand Down
26 changes: 16 additions & 10 deletions georiviere/contribution/locale/fr/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -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"

Expand All @@ -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"

Expand All @@ -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"

Expand Down Expand Up @@ -281,9 +290,6 @@ msgstr "Contributions éléments paysagers"
msgid "Stream"
msgstr "Rivière"

msgid "Status"
msgstr "Status"

msgid "Morphologies"
msgstr "Morphologies"

Expand Down
18 changes: 18 additions & 0 deletions georiviere/contribution/migrations/0005_contribution_validated.py
Original file line number Diff line number Diff line change
@@ -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'),
),
]
Original file line number Diff line number Diff line change
@@ -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'),
),
]
6 changes: 4 additions & 2 deletions georiviere/contribution/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
</tr>
{% endif %}
{% include "mapentity/trackinfo_fragment.html" %}
{% include "main/publication_info_fragment.html" %}
</table>
{{ block.super }}
{% endblock attributes %}
4 changes: 3 additions & 1 deletion georiviere/contribution/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
81 changes: 78 additions & 3 deletions georiviere/main/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand All @@ -24,6 +24,12 @@ msgstr ""
msgid "Restricted area"
msgstr ""

msgid "Creator"
msgstr ""

msgid "User that uploaded"
msgstr ""

msgid "Name"
msgstr ""

Expand All @@ -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 ""
Loading

0 comments on commit af6a941

Please sign in to comment.