diff --git a/projects/notifications.py b/projects/notifications.py index 5b2fd10f9d1be9f252f837592dfe6e15a123edf4..7ee9008841f675eed76cf5ad53a507656df69f8b 100644 --- a/projects/notifications.py +++ b/projects/notifications.py @@ -1,9 +1,11 @@ """Projects notifications.""" +from django.shortcuts import reverse +from django.utils.timezone import now from mails import Notification -from django.utils.timezone import now from users.models import User + from .models import Edition, Project @@ -29,6 +31,16 @@ class _NotifyOrgnizers(_BaseParticipationNotification): def get_subject(self): return f'{self.title}: {self.edition}' + def _get_editionform_admin_url(self) -> str: + base = 'https://oser-backend.herokuapp.com' + view = reverse('admin:projects_editionform_changelist') + return base + view + + def get_context(self) -> dict: + context = super().get_context() + context['editionform_admin_url'] = self._get_editionform_admin_url() + return context + def get_recipients(self): """Return the email of each organizer.""" edition = self.kwargs['edition'] @@ -42,7 +54,7 @@ class _NotifyUser(_BaseParticipationNotification): verb: str def get_subject(self): - return f'Dossier {self.verb}: {self.edition}' + return f'Participation {self.verb}: {self.edition}' def get_recipients(self): return [self.kwargs['user'].email] @@ -65,35 +77,35 @@ class UserReceived(_NotifyUser): class UserValid(_NotifyUser): """Notify a user their participation was marked as valid.""" - verb = 'validé' + verb = 'vérifiée' template_name = 'projects/participation_valid.md' class UserAccepted(_NotifyUser): """Notify a user their participation was marked as accepted.""" - verb = 'accepté' + verb = 'acceptée' template_name = 'projects/participation_accepted.md' class UserRejected(_NotifyUser): """Notify a user their participation was marked as rejected.""" - verb = 'rejeté' + verb = 'rejetée' template_name = 'projects/participation_rejected.md' class UserCancelled(_NotifyUser): """Notify a user their participation was correctly cancelled.""" - verb = 'annulé' + verb = 'annulée' template_name = 'projects/participation_cancelled.md' class UserDeleted(_NotifyUser): """Notify a user their participation was correctly deleted.""" - verb = 'supprimé' + verb = 'supprimée' template_name = 'projects/participation_deleted.md' diff --git a/projects/templates/projects/organizers_participation_cancelled.md b/projects/templates/projects/organizers_participation_cancelled.md index b3c82fdecad51c73ec2c3f4e608823c7e8a233cd..6cb2ca7fd8da492a3a9387ed9c20d3f43db229df 100644 --- a/projects/templates/projects/organizers_participation_cancelled.md +++ b/projects/templates/projects/organizers_participation_cancelled.md @@ -5,5 +5,5 @@ L'utilisateur {{ user }} a supprimé sa participation à {{ edition }}. Si besoin, vous pouvez contacter {{ user }} via son adresse email : {{ user.email }}. -Vous pouvez télécharger la feuille des inscrits mise à jour sur [le site d'administration]({% url 'admin:projects_editionform_changelist' %}). +Vous pouvez télécharger la feuille des inscrits mise à jour sur [le site d'administration]({{ editionform_admin_url }}). {% endblock %} diff --git a/projects/templates/projects/organizers_participation_deleted.md b/projects/templates/projects/organizers_participation_deleted.md index b6648b782fd8f479aa3289e88ba1b086d9505ddf..edd36920c1658e8a618743e69cf106b74e8c3fa0 100644 --- a/projects/templates/projects/organizers_participation_deleted.md +++ b/projects/templates/projects/organizers_participation_deleted.md @@ -5,5 +5,5 @@ L'utilisateur {{ user }} a annulé sa participation à {{ edition }}. Si besoin, vous pouvez contacter {{ user }} via son adresse email : {{ user.email }}. -Vous pouvez télécharger la feuille des inscrits mise à jour sur [le site d'administration]({% url 'admin:projects_editionform_changelist' %}). +Vous pouvez télécharger la feuille des inscrits mise à jour sur [le site d'administration]({{ editionform_admin_url }}). {% endblock %} diff --git a/projects/templates/projects/organizers_participation_received.md b/projects/templates/projects/organizers_participation_received.md index 5b19339db56355315e7517040c868fcbd9885b2d..98f48d8199e7fc844e374be452a1185d17a09cea 100644 --- a/projects/templates/projects/organizers_participation_received.md +++ b/projects/templates/projects/organizers_participation_received.md @@ -3,5 +3,5 @@ {% block body %} {{ user }} s'est inscrit à {{ edition }}. -Vous pouvez télécharger la feuille des inscrits mise à jour sur [le site d'administration](https://{{ request.get_host }}{% url 'admin:projects_editionform_changelist' %}). +Vous pouvez télécharger la feuille des inscrits mise à jour sur [le site d'administration]({{ editionform_admin_url }}). {% endblock %}