Compare commits
No commits in common. "c4c560d11ceab779747f5d073f39f46425ef5807" and "fd7a82e56946d2fcc3de38596b6ff90fe122c11b" have entirely different histories.
c4c560d11c
...
fd7a82e569
@ -8,13 +8,11 @@ Created on: 16.11.21
|
||||
import shutil
|
||||
|
||||
from django.contrib import messages
|
||||
from django.urls import reverse
|
||||
|
||||
from analysis.settings import LKOMPVZVO_PUBLISH_DATE
|
||||
from codelist.models import KonovaCode
|
||||
from compensation.settings import COMPENSATION_IDENTIFIER_TEMPLATE, COMPENSATION_IDENTIFIER_LENGTH, \
|
||||
COMPENSATION_LANIS_LAYER_NAME_RECORDED, COMPENSATION_LANIS_LAYER_NAME_UNRECORDED, COMPENSATION_LANIS_LAYER_NAME_UNRECORDED_OLD_ENTRY
|
||||
from konova.sub_settings.django_settings import BASE_URL
|
||||
from user.models import User, Team
|
||||
from django.db import models, transaction
|
||||
from django.db.models import QuerySet, Sum
|
||||
@ -309,13 +307,6 @@ class Compensation(AbstractCompensation, CEFMixin, CoherenceMixin, PikMixin):
|
||||
def __str__(self):
|
||||
return "{}".format(self.identifier)
|
||||
|
||||
def get_detail_url(self):
|
||||
return reverse("compensation:detail", args=(self.id,))
|
||||
|
||||
def get_detail_url_absolute(self):
|
||||
return BASE_URL + self.get_detail_url()
|
||||
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if self.identifier is None or len(self.identifier) == 0:
|
||||
# Create new identifier is none was given
|
||||
|
@ -11,7 +11,6 @@ from django.urls import reverse
|
||||
|
||||
from compensation.settings import ECO_ACCOUNT_IDENTIFIER_TEMPLATE, ECO_ACCOUNT_IDENTIFIER_LENGTH, \
|
||||
ECO_ACCOUNT_LANIS_LAYER_NAME_RECORDED, ECO_ACCOUNT_LANIS_LAYER_NAME_UNRECORDED
|
||||
from konova.sub_settings.django_settings import BASE_URL
|
||||
from konova.utils.message_templates import DEDUCTION_REMOVED, DOCUMENT_REMOVED_TEMPLATE
|
||||
from django.core.validators import MinValueValidator
|
||||
from django.db import models
|
||||
@ -59,12 +58,6 @@ class EcoAccount(AbstractCompensation, ShareableObjectMixin, RecordableObjectMix
|
||||
def __str__(self):
|
||||
return f"{self.identifier} ({self.title})"
|
||||
|
||||
def get_detail_url(self):
|
||||
return reverse("compensation:acc:detail", args=(self.id,))
|
||||
|
||||
def get_detail_url_absolute(self):
|
||||
return BASE_URL + self.get_detail_url()
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if self.identifier is None or len(self.identifier) == 0:
|
||||
# Create new identifier if none was given
|
||||
@ -168,12 +161,12 @@ class EcoAccount(AbstractCompensation, ShareableObjectMixin, RecordableObjectMix
|
||||
# Send mail
|
||||
shared_users = self.shared_users.values_list("id", flat=True)
|
||||
for user_id in shared_users:
|
||||
celery_send_mail_deduction_changed.delay(self.id, self.get_app_object_tuple(), user_id, data_change)
|
||||
celery_send_mail_deduction_changed.delay(self.identifier, self.title, user_id, data_change)
|
||||
|
||||
# Send mail
|
||||
shared_teams = self.shared_teams.values_list("id", flat=True)
|
||||
for team_id in shared_teams:
|
||||
celery_send_mail_deduction_changed_team.delay(self.id, self.get_app_object_tuple(), team_id, data_change)
|
||||
celery_send_mail_deduction_changed_team.delay(self.identifier, self.title, team_id, data_change)
|
||||
|
||||
def update_deductable_rest(self):
|
||||
"""
|
||||
|
@ -19,7 +19,6 @@ from ema.settings import EMA_IDENTIFIER_LENGTH, EMA_IDENTIFIER_TEMPLATE, EMA_LAN
|
||||
EMA_LANIS_LAYER_NAME_UNRECORDED
|
||||
from ema.utils.quality import EmaQualityChecker
|
||||
from konova.models import AbstractDocument, generate_document_file_upload_path, RecordableObjectMixin, ShareableObjectMixin
|
||||
from konova.sub_settings.django_settings import BASE_URL
|
||||
from konova.utils.message_templates import DATA_UNSHARED_EXPLANATION, DOCUMENT_REMOVED_TEMPLATE
|
||||
|
||||
|
||||
@ -47,12 +46,6 @@ class Ema(AbstractCompensation, ShareableObjectMixin, RecordableObjectMixin, Pik
|
||||
def __str__(self):
|
||||
return "{}".format(self.identifier)
|
||||
|
||||
def get_detail_url(self):
|
||||
return reverse("ema:detail", args=(self.id,))
|
||||
|
||||
def get_detail_url_absolute(self):
|
||||
return BASE_URL + self.get_detail_url()
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if self.identifier is None or len(self.identifier) == 0:
|
||||
# Create new identifier
|
||||
|
@ -18,7 +18,6 @@ from intervention.settings import INTERVENTION_IDENTIFIER_LENGTH, INTERVENTION_I
|
||||
INTERVENTION_LANIS_LAYER_NAME_RECORDED, INTERVENTION_LANIS_LAYER_NAME_UNRECORDED_OLD_ENTRY, \
|
||||
INTERVENTION_LANIS_LAYER_NAME_UNRECORDED
|
||||
from intervention.tasks import celery_export_to_egon
|
||||
from konova.sub_settings.django_settings import BASE_URL
|
||||
from user.models import User
|
||||
from django.db import models, transaction
|
||||
from django.db.models import QuerySet
|
||||
@ -70,12 +69,6 @@ class Intervention(BaseObject,
|
||||
def __str__(self):
|
||||
return f"{self.identifier} ({self.title})"
|
||||
|
||||
def get_detail_url(self):
|
||||
return reverse("intervention:detail", args=(self.id,))
|
||||
|
||||
def get_detail_url_absolute(self):
|
||||
return BASE_URL + self.get_detail_url()
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
""" Custom save functionality
|
||||
|
||||
|
@ -116,13 +116,14 @@ class DeletableObjectMixin(models.Model):
|
||||
if send_mail:
|
||||
# Send mail
|
||||
shared_users = self.shared_users.values_list("id", flat=True)
|
||||
municipals_names = list(self.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
for user_id in shared_users:
|
||||
celery_send_mail_shared_data_deleted.delay(self.id, self.get_app_object_tuple(), user_id)
|
||||
celery_send_mail_shared_data_deleted.delay(self.identifier, self.title, user_id, municipals_names)
|
||||
|
||||
# Send mail
|
||||
shared_teams = self.shared_teams.values_list("id", flat=True)
|
||||
for team_id in shared_teams:
|
||||
celery_send_mail_shared_data_deleted_team.delay(self.id, self.get_app_object_tuple(), team_id)
|
||||
celery_send_mail_shared_data_deleted_team.delay(self.identifier, self.title, team_id, municipals_names)
|
||||
|
||||
self.save()
|
||||
|
||||
@ -215,14 +216,6 @@ class BaseObject(BaseResource, DeletableObjectMixin):
|
||||
def get_detail_url(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
def get_app_object_tuple(self):
|
||||
""" Getter for a tuple, consisting of app and object name of the object
|
||||
|
||||
Returns:
|
||||
tuple (tuple)
|
||||
"""
|
||||
return (self._meta.app_label, self._meta.object_name)
|
||||
|
||||
|
||||
class RecordableObjectMixin(models.Model):
|
||||
""" Wraps record related fields and functionality
|
||||
@ -260,12 +253,13 @@ class RecordableObjectMixin(models.Model):
|
||||
|
||||
shared_users = self.shared_users.values_list("id", flat=True)
|
||||
shared_teams = self.shared_teams.values_list("id", flat=True)
|
||||
municipals_names = list(self.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
|
||||
for user_id in shared_users:
|
||||
celery_send_mail_shared_data_unrecorded.delay(self.id, self.get_app_object_tuple(), user_id)
|
||||
celery_send_mail_shared_data_unrecorded.delay(self.identifier, self.title, user_id, municipals_names)
|
||||
|
||||
for team_id in shared_teams:
|
||||
celery_send_mail_shared_data_unrecorded_team.delay(self.id, self.get_app_object_tuple(), team_id)
|
||||
celery_send_mail_shared_data_unrecorded_team.delay(self.identifier, self.title, team_id, municipals_names)
|
||||
|
||||
return action
|
||||
|
||||
@ -290,12 +284,13 @@ class RecordableObjectMixin(models.Model):
|
||||
|
||||
shared_users = self.shared_users.values_list("id", flat=True)
|
||||
shared_teams = self.shared_teams.values_list("id", flat=True)
|
||||
municipals_names = list(self.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
|
||||
for user_id in shared_users:
|
||||
celery_send_mail_shared_data_recorded.delay(self.id, self.get_app_object_tuple(), user_id)
|
||||
celery_send_mail_shared_data_recorded.delay(self.identifier, self.title, user_id, municipals_names)
|
||||
|
||||
for team_id in shared_teams:
|
||||
celery_send_mail_shared_data_recorded_team.delay(self.id, self.get_app_object_tuple(), team_id)
|
||||
celery_send_mail_shared_data_recorded_team.delay(self.identifier, self.title, team_id, municipals_names)
|
||||
|
||||
return action
|
||||
|
||||
@ -366,15 +361,17 @@ class CheckableObjectMixin(models.Model):
|
||||
self.checked = action
|
||||
self.save()
|
||||
|
||||
municipals_names = list(self.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
|
||||
# Send mail
|
||||
shared_users = self.shared_users.values_list("id", flat=True)
|
||||
for user_id in shared_users:
|
||||
celery_send_mail_shared_data_checked.delay(self.id, self.get_app_object_tuple(), user_id)
|
||||
celery_send_mail_shared_data_checked.delay(self.identifier, self.title, user_id, municipals_names)
|
||||
|
||||
# Send mail
|
||||
shared_teams = self.shared_teams.values_list("id", flat=True)
|
||||
for team_id in shared_teams:
|
||||
celery_send_mail_shared_data_checked_team.delay(self.id, self.get_app_object_tuple(), team_id)
|
||||
celery_send_mail_shared_data_checked_team.delay(self.identifier, self.title, team_id, municipals_names)
|
||||
|
||||
self.log.add(action)
|
||||
return action
|
||||
@ -557,10 +554,11 @@ class ShareableObjectMixin(models.Model):
|
||||
id__in=shared_teams
|
||||
).values_list("id", flat=True)
|
||||
|
||||
municipals_names = list(self.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
for team_id in new_teams:
|
||||
celery_send_mail_shared_access_given_team.delay(self.id, self.get_app_object_tuple(), team_id)
|
||||
celery_send_mail_shared_access_given_team.delay(self.identifier, self.title, team_id, municipals_names)
|
||||
for team_id in removed_teams:
|
||||
celery_send_mail_shared_access_removed_team.delay(self.id, self.get_app_object_tuple(), team_id)
|
||||
celery_send_mail_shared_access_removed_team.delay(self.identifier, self.title, team_id, municipals_names)
|
||||
|
||||
self.share_with_team_list(accessing_teams)
|
||||
|
||||
@ -585,11 +583,12 @@ class ShareableObjectMixin(models.Model):
|
||||
id__in=shared_users
|
||||
).values_list("id", flat=True)
|
||||
|
||||
municipals_names = list(self.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
# Send mails
|
||||
for user_id in removed_users:
|
||||
celery_send_mail_shared_access_removed.delay(self.id, self.get_app_object_tuple(), user_id)
|
||||
celery_send_mail_shared_access_removed.delay(self.identifier, self.title, user_id, municipals_names)
|
||||
for user_id in new_users:
|
||||
celery_send_mail_shared_access_given.delay(self.id, self.get_app_object_tuple(), user_id)
|
||||
celery_send_mail_shared_access_given.delay(self.identifier, self.title, user_id, municipals_names)
|
||||
|
||||
# Set new shared users
|
||||
self.share_with_user_list(accessing_users)
|
||||
@ -651,8 +650,9 @@ class ShareableObjectMixin(models.Model):
|
||||
default_users.append(user)
|
||||
self.share_with_user_list(cleaned_users)
|
||||
|
||||
municipals_names = list(self.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
for user in default_users:
|
||||
celery_send_mail_shared_access_removed.delay(self.id, self.get_app_object_tuple(), user.id)
|
||||
celery_send_mail_shared_access_removed.delay(self.identifier, self.title, user.id, municipals_names)
|
||||
|
||||
|
||||
class GeoReferencedMixin(models.Model):
|
||||
@ -744,5 +744,6 @@ class ResubmitableObjectMixin(models.Model):
|
||||
|
||||
"""
|
||||
resubmissions = self.resubmissions.all()
|
||||
municipal_names = list(self.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
for resubmission in resubmissions:
|
||||
resubmission.send_resubmission_mail(self.id, self.get_app_object_tuple())
|
||||
resubmission.send_resubmission_mail(self.identifier, municipal_names)
|
||||
|
@ -6,7 +6,6 @@ Created on: 15.08.22
|
||||
|
||||
"""
|
||||
from dateutil.utils import today
|
||||
from django.apps import apps
|
||||
from django.db import models
|
||||
|
||||
from konova.models import BaseResource
|
||||
@ -32,20 +31,16 @@ class Resubmission(BaseResource):
|
||||
help_text="Optional comment for the user itself"
|
||||
)
|
||||
|
||||
def send_resubmission_mail(self, obj_id, obj_class):
|
||||
def send_resubmission_mail(self, obj_identifier, municipal_names):
|
||||
""" Sends a resubmission mail
|
||||
|
||||
"""
|
||||
obj_class = apps.get_model(obj_class[0], obj_class[1])
|
||||
obj = obj_class.objects.get(id=obj_id)
|
||||
municipal_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
|
||||
_today = today().date()
|
||||
resubmission_handled = _today.__ge__(self.resubmit_on) and self.resubmission_sent
|
||||
if resubmission_handled:
|
||||
return
|
||||
|
||||
mailer = Mailer()
|
||||
mailer.send_mail_resubmission(obj, self, municipal_names)
|
||||
mailer.send_mail_resubmission(obj_identifier, self, municipal_names)
|
||||
self.resubmission_sent = True
|
||||
self.save()
|
||||
|
@ -37,8 +37,6 @@ ADMINS = [
|
||||
('KSP-Servicestelle', 'ksp-servicestelle@sgdnord.rlp.de'),
|
||||
]
|
||||
|
||||
BASE_URL = "http://localhost:8001"
|
||||
|
||||
ALLOWED_HOSTS = [
|
||||
"127.0.0.1",
|
||||
"localhost",
|
||||
|
123
konova/tasks.py
123
konova/tasks.py
@ -1,7 +1,6 @@
|
||||
from time import sleep
|
||||
|
||||
from celery import shared_task
|
||||
from django.apps import apps
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
|
||||
|
||||
@ -26,167 +25,101 @@ def celery_update_parcels(geometry_id: str, recheck: bool = True):
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_shared_access_removed(obj_id, obj_class, user_id=None):
|
||||
def celery_send_mail_shared_access_removed(obj_identifier, obj_title=None, user_id=None, municipals_names=[]):
|
||||
from user.models import User
|
||||
user = User.objects.get(id=user_id)
|
||||
|
||||
obj_class = apps.get_model(obj_class[0], obj_class[1])
|
||||
obj = obj_class.objects.get(id=obj_id)
|
||||
|
||||
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
user.send_mail_shared_access_removed(obj, municipals_names)
|
||||
user.send_mail_shared_access_removed(obj_identifier, obj_title, municipals_names)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_shared_access_given(obj_id, obj_class, user_id=None):
|
||||
def celery_send_mail_shared_access_given(obj_identifier, obj_title=None, user_id=None, municipals_names=[]):
|
||||
from user.models import User
|
||||
user = User.objects.get(id=user_id)
|
||||
|
||||
obj_class = apps.get_model(obj_class[0], obj_class[1])
|
||||
obj = obj_class.objects.get(id=obj_id)
|
||||
|
||||
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
user.send_mail_shared_access_given(obj, municipals_names)
|
||||
user.send_mail_shared_access_given(obj_identifier, obj_title, municipals_names)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_shared_access_removed_team(obj_id, obj_class, team_id=None):
|
||||
def celery_send_mail_shared_access_removed_team(obj_identifier, obj_title=None, team_id=None, municipals_names=[]):
|
||||
from user.models import Team
|
||||
team = Team.objects.get(id=team_id)
|
||||
|
||||
obj_class = apps.get_model(obj_class[0], obj_class[1])
|
||||
obj = obj_class.objects.get(id=obj_id)
|
||||
|
||||
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
team.send_mail_shared_access_removed(obj, municipals_names)
|
||||
team.send_mail_shared_access_removed(obj_identifier, obj_title, municipals_names)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_shared_access_given_team(obj_id, obj_class, team_id=None):
|
||||
def celery_send_mail_shared_access_given_team(obj_identifier, obj_title=None, team_id=None, municipals_names=[]):
|
||||
from user.models import Team
|
||||
team = Team.objects.get(id=team_id)
|
||||
|
||||
obj_class = apps.get_model(obj_class[0], obj_class[1])
|
||||
obj = obj_class.objects.get(id=obj_id)
|
||||
|
||||
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
team.send_mail_shared_access_given_team(obj, municipals_names)
|
||||
team.send_mail_shared_access_given_team(obj_identifier, obj_title, municipals_names)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_shared_data_recorded(obj_id, obj_class, user_id=None):
|
||||
def celery_send_mail_shared_data_recorded(obj_identifier, obj_title=None, user_id=None, municipals_names=[]):
|
||||
from user.models import User
|
||||
user = User.objects.get(id=user_id)
|
||||
|
||||
obj_class = apps.get_model(obj_class[0], obj_class[1])
|
||||
obj = obj_class.objects.get(id=obj_id)
|
||||
|
||||
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
user.send_mail_shared_data_recorded(obj, municipals_names)
|
||||
user.send_mail_shared_data_recorded(obj_identifier, obj_title, municipals_names)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_shared_data_unrecorded(obj_id, obj_class, user_id=None):
|
||||
def celery_send_mail_shared_data_unrecorded(obj_identifier, obj_title=None, user_id=None, municipals_names=[]):
|
||||
from user.models import User
|
||||
user = User.objects.get(id=user_id)
|
||||
|
||||
obj_class = apps.get_model(obj_class[0], obj_class[1])
|
||||
obj = obj_class.objects.get(id=obj_id)
|
||||
|
||||
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
user.send_mail_shared_data_unrecorded(obj, municipals_names)
|
||||
user.send_mail_shared_data_unrecorded(obj_identifier, obj_title, municipals_names)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_shared_data_recorded_team(obj_id, obj_class, team_id=None):
|
||||
def celery_send_mail_shared_data_recorded_team(obj_identifier, obj_title=None, team_id=None, municipals_names=[]):
|
||||
from user.models import Team
|
||||
team = Team.objects.get(id=team_id)
|
||||
|
||||
obj_class = apps.get_model(obj_class[0], obj_class[1])
|
||||
obj = obj_class.objects.get(id=obj_id)
|
||||
|
||||
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
team.send_mail_shared_data_recorded(obj, municipals_names)
|
||||
team.send_mail_shared_data_recorded(obj_identifier, obj_title, municipals_names)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_shared_data_unrecorded_team(obj_id, obj_class, team_id=None):
|
||||
def celery_send_mail_shared_data_unrecorded_team(obj_identifier, obj_title=None, team_id=None, municipals_names=[]):
|
||||
from user.models import Team
|
||||
team = Team.objects.get(id=team_id)
|
||||
|
||||
obj_class = apps.get_model(obj_class[0], obj_class[1])
|
||||
obj = obj_class.objects.get(id=obj_id)
|
||||
|
||||
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
team.send_mail_shared_data_unrecorded(obj, municipals_names)
|
||||
team.send_mail_shared_data_unrecorded(obj_identifier, obj_title, municipals_names)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_shared_data_deleted(obj_id, obj_class, user_id=None):
|
||||
def celery_send_mail_shared_data_deleted(obj_identifier, obj_title=None, user_id=None, municipals_names=[]):
|
||||
from user.models import User
|
||||
user = User.objects.get(id=user_id)
|
||||
|
||||
obj_class = apps.get_model(obj_class[0], obj_class[1])
|
||||
obj = obj_class.objects.get(id=obj_id)
|
||||
|
||||
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
user.send_mail_shared_data_deleted(obj, municipals_names)
|
||||
user.send_mail_shared_data_deleted(obj_identifier, obj_title, municipals_names)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_shared_data_checked(obj_id, obj_class, user_id=None):
|
||||
def celery_send_mail_shared_data_checked(obj_identifier, obj_title=None, user_id=None, municipals_names=[]):
|
||||
from user.models import User
|
||||
user = User.objects.get(id=user_id)
|
||||
|
||||
obj_class = apps.get_model(obj_class[0], obj_class[1])
|
||||
obj = obj_class.objects.get(id=obj_id)
|
||||
|
||||
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
user.send_mail_shared_data_checked(obj, municipals_names)
|
||||
user.send_mail_shared_data_checked(obj_identifier, obj_title, municipals_names)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_shared_data_deleted_team(obj_id, obj_class, team_id=None):
|
||||
def celery_send_mail_shared_data_deleted_team(obj_identifier, obj_title=None, team_id=None, municipals_names=[]):
|
||||
from user.models import Team
|
||||
team = Team.objects.get(id=team_id)
|
||||
|
||||
obj_class = apps.get_model(obj_class[0], obj_class[1])
|
||||
obj = obj_class.objects.get(id=obj_id)
|
||||
|
||||
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
team.send_mail_shared_data_deleted(obj, municipals_names)
|
||||
team.send_mail_shared_data_deleted(obj_identifier, obj_title, municipals_names)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_shared_data_checked_team(obj_id, obj_class, team_id=None):
|
||||
def celery_send_mail_shared_data_checked_team(obj_identifier, obj_title=None, team_id=None, municipals_names=[]):
|
||||
from user.models import Team
|
||||
team = Team.objects.get(id=team_id)
|
||||
|
||||
obj_class = apps.get_model(obj_class[0], obj_class[1])
|
||||
obj = obj_class.objects.get(id=obj_id)
|
||||
|
||||
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
|
||||
team.send_mail_shared_data_checked(obj, municipals_names)
|
||||
team.send_mail_shared_data_checked(obj_identifier, obj_title, municipals_names)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_deduction_changed_team(obj_id, obj_class, team_id=None, data_changes=None):
|
||||
def celery_send_mail_deduction_changed_team(obj_identifier, obj_title=None, team_id=None, data_changes=None):
|
||||
from user.models import Team
|
||||
team = Team.objects.get(id=team_id)
|
||||
|
||||
obj_class = apps.get_model(obj_class[0], obj_class[1])
|
||||
obj = obj_class.objects.get(id=obj_id)
|
||||
team.send_mail_deduction_changed(obj, data_changes)
|
||||
team.send_mail_deduction_changed(obj_identifier, obj_title, data_changes)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_deduction_changed(obj_id, obj_class, user_id=None, data_changes=None):
|
||||
def celery_send_mail_deduction_changed(obj_identifier, obj_title=None, user_id=None, data_changes=None):
|
||||
from user.models import User
|
||||
user = User.objects.get(id=user_id)
|
||||
|
||||
obj_class = apps.get_model(obj_class[0], obj_class[1])
|
||||
obj = obj_class.objects.get(id=obj_id)
|
||||
user.send_mail_deduction_changed(obj, data_changes)
|
||||
user.send_mail_deduction_changed(obj_identifier, obj_title, data_changes)
|
||||
|
||||
|
||||
@shared_task
|
||||
|
@ -193,7 +193,9 @@ class ResubmissionTestCase(BaseTestCase):
|
||||
|
||||
self.assertFalse(resubmission.resubmission_sent)
|
||||
resubmission.send_resubmission_mail(
|
||||
self.intervention.id,
|
||||
self.intervention.get_app_object_tuple()
|
||||
self.intervention.identifier,
|
||||
[
|
||||
"Test_municipal_1"
|
||||
],
|
||||
)
|
||||
self.assertTrue(resubmission.resubmission_sent)
|
||||
|
@ -45,11 +45,12 @@ class Mailer:
|
||||
auth_password=self.auth_password
|
||||
)
|
||||
|
||||
def send_mail_shared_access_removed(self, obj, user, municipals_names):
|
||||
def send_mail_shared_access_removed(self, obj_identifier, obj_title, user, municipals_names):
|
||||
""" Send a mail if user has no access to the object anymore
|
||||
|
||||
Args:
|
||||
obj (): The object
|
||||
obj_identifier (str): The object identifier
|
||||
obj_title (str): The object title
|
||||
user (User): Related user
|
||||
municipals_names (iterable): List of municipals of the entry
|
||||
|
||||
@ -58,7 +59,8 @@ class Mailer:
|
||||
"""
|
||||
context = {
|
||||
"user": user,
|
||||
"obj": obj,
|
||||
"obj_identifier": obj_identifier,
|
||||
"obj_title": obj_title,
|
||||
"municipals_names": municipals_names,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
}
|
||||
@ -66,15 +68,16 @@ class Mailer:
|
||||
user_mail_address = [user.email]
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("{} - Shared access removed").format(obj.identifier),
|
||||
_("{} - Shared access removed").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_shared_access_given(self, obj, user, municipals_names):
|
||||
def send_mail_shared_access_given(self, obj_identifier, obj_title, user, municipals_names):
|
||||
""" Send a mail if user just got access to the object
|
||||
|
||||
Args:
|
||||
obj (): The object
|
||||
obj_identifier (str): The object identifier
|
||||
obj_title (str): The object title
|
||||
user (User): The related user
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
@ -83,7 +86,8 @@ class Mailer:
|
||||
"""
|
||||
context = {
|
||||
"user": user,
|
||||
"obj": obj,
|
||||
"obj_identifier": obj_identifier,
|
||||
"obj_title": obj_title,
|
||||
"municipals_names": municipals_names,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
}
|
||||
@ -91,15 +95,16 @@ class Mailer:
|
||||
user_mail_address = [user.email]
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("{} - Shared access given").format(obj.identifier),
|
||||
_("{} - Shared access given").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_shared_access_given_team(self, obj, team, users_to_notify, municipals_names):
|
||||
def send_mail_shared_access_given_team(self, obj_identifier, obj_title, team, users_to_notify, municipals_names):
|
||||
""" Send a mail if a team just got access to the object
|
||||
|
||||
Args:
|
||||
obj (): The object
|
||||
obj_identifier (str): The object identifier
|
||||
obj_title (str): Title of the main object
|
||||
team (Team): Team to be notified
|
||||
users_to_notify (QueryDict): Contains the team users which should be notified
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
@ -109,7 +114,8 @@ class Mailer:
|
||||
"""
|
||||
context = {
|
||||
"team": team,
|
||||
"obj": obj,
|
||||
"obj_identifier": obj_identifier,
|
||||
"obj_title": obj_title,
|
||||
"municipals_names": municipals_names,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
}
|
||||
@ -117,15 +123,16 @@ class Mailer:
|
||||
user_mail_address = users_to_notify.values_list("email", flat=True)
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("{} - Shared access given").format(obj.identifier),
|
||||
_("{} - Shared access given").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_shared_access_removed_team(self, obj, team, users_to_notify, municipals_names):
|
||||
def send_mail_shared_access_removed_team(self, obj_identifier, obj_title, team, users_to_notify, municipals_names):
|
||||
""" Send a mail if a team just lost access to the object
|
||||
|
||||
Args:
|
||||
obj (): The object
|
||||
obj_identifier (str): The object identifier
|
||||
obj_title (str): Title of the main object
|
||||
team (Team): Team to be notified
|
||||
users_to_notify (QueryDict): Contains the team users which should be notified
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
@ -135,7 +142,8 @@ class Mailer:
|
||||
"""
|
||||
context = {
|
||||
"team": team,
|
||||
"obj": obj,
|
||||
"obj_identifier": obj_identifier,
|
||||
"obj_title": obj_title,
|
||||
"municipals_names": municipals_names,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
}
|
||||
@ -143,15 +151,16 @@ class Mailer:
|
||||
user_mail_address = users_to_notify.values_list("email", flat=True)
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("{} - Shared access removed").format(obj.identifier),
|
||||
_("{} - Shared access removed").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_shared_data_unrecorded_team(self,obj, team, users_to_notify, municipals_names):
|
||||
def send_mail_shared_data_unrecorded_team(self, obj_identifier, obj_title, team, users_to_notify, municipals_names):
|
||||
""" Send a mail if data has just been unrecorded
|
||||
|
||||
Args:
|
||||
obj (): The object
|
||||
obj_identifier (str): The object identifier
|
||||
obj_title (str): Title of the main object
|
||||
team (Team): Team to be notified
|
||||
users_to_notify (QueryDict): Contains the team users which should be notified
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
@ -161,7 +170,8 @@ class Mailer:
|
||||
"""
|
||||
context = {
|
||||
"team": team,
|
||||
"obj": obj,
|
||||
"obj_identifier": obj_identifier,
|
||||
"obj_title": obj_title,
|
||||
"municipals_names": municipals_names,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
}
|
||||
@ -169,15 +179,16 @@ class Mailer:
|
||||
user_mail_address = users_to_notify.values_list("email", flat=True)
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("{} - Shared data unrecorded").format(obj.identifier),
|
||||
_("{} - Shared data unrecorded").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_shared_data_recorded_team(self, obj, team, users_to_notify, municipals_names):
|
||||
def send_mail_shared_data_recorded_team(self, obj_identifier, obj_title, team, users_to_notify, municipals_names):
|
||||
""" Send a mail if data has just been recorded
|
||||
|
||||
Args:
|
||||
obj (): The object
|
||||
obj_identifier (str): The object identifier
|
||||
obj_title (str): Title of the main object
|
||||
team (Team): Team to be notified
|
||||
users_to_notify (QueryDict): Contains the team users which should be notified
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
@ -187,7 +198,8 @@ class Mailer:
|
||||
"""
|
||||
context = {
|
||||
"team": team,
|
||||
"obj": obj,
|
||||
"obj_identifier": obj_identifier,
|
||||
"obj_title": obj_title,
|
||||
"municipals_names": municipals_names,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
}
|
||||
@ -195,15 +207,16 @@ class Mailer:
|
||||
user_mail_address = users_to_notify.values_list("email", flat=True)
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("{} - Shared data recorded").format(obj.identifier),
|
||||
_("{} - Shared data recorded").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_shared_data_checked_team(self, obj, team, users_to_notify, municipals_names):
|
||||
def send_mail_shared_data_checked_team(self, obj_identifier, obj_title, team, users_to_notify, municipals_names):
|
||||
""" Send a mail if data has just been checked
|
||||
|
||||
Args:
|
||||
obj (): The object
|
||||
obj_identifier (str): The object identifier
|
||||
obj_title (str): Title of the main object
|
||||
team (Team): Team to be notified
|
||||
users_to_notify (QueryDict): Contains the team users which should be notified
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
@ -213,7 +226,8 @@ class Mailer:
|
||||
"""
|
||||
context = {
|
||||
"team": team,
|
||||
"obj": obj,
|
||||
"obj_identifier": obj_identifier,
|
||||
"obj_title": obj_title,
|
||||
"municipals_names": municipals_names,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
}
|
||||
@ -221,15 +235,16 @@ class Mailer:
|
||||
user_mail_address = users_to_notify.values_list("email", flat=True)
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("{} - Shared data checked").format(obj.identifier),
|
||||
_("{} - Shared data checked").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_deduction_changed_team(self, obj, team, data_changes, users_to_notify):
|
||||
def send_mail_deduction_changed_team(self, obj_identifier, obj_title, team, data_changes, users_to_notify):
|
||||
""" Send a mail if deduction has been changed
|
||||
|
||||
Args:
|
||||
obj (): The object
|
||||
obj_identifier (str): Identifier of the main object
|
||||
obj_title (str): Title of the main object
|
||||
team (Team): Team to be notified
|
||||
data_changes (dict): Contains the old|new changes of the deduction changes
|
||||
users_to_notify (QueryDict): Contains the team users which should be notified
|
||||
@ -238,7 +253,8 @@ class Mailer:
|
||||
"""
|
||||
context = {
|
||||
"team": team,
|
||||
"obj": obj,
|
||||
"obj_identifier": obj_identifier,
|
||||
"obj_title": obj_title,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
"data_changes": data_changes,
|
||||
}
|
||||
@ -246,15 +262,16 @@ class Mailer:
|
||||
user_mail_address = users_to_notify.values_list("email", flat=True)
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("{} - Deduction changed").format(obj.identifier),
|
||||
_("{} - Deduction changed").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_shared_data_deleted_team(self, obj, team, users_to_notify, municipals_names):
|
||||
def send_mail_shared_data_deleted_team(self, obj_identifier, obj_title, team, users_to_notify, municipals_names):
|
||||
""" Send a mail if data has just been deleted
|
||||
|
||||
Args:
|
||||
obj (): The object
|
||||
obj_identifier (str): The object identifier
|
||||
obj_title (str): The object title
|
||||
team (Team): The related team
|
||||
users_to_notify (QuerySet): Contains team users who want to be notified
|
||||
municipals_names (iterable): List of municipals for the entry
|
||||
@ -264,7 +281,8 @@ class Mailer:
|
||||
"""
|
||||
context = {
|
||||
"team": team,
|
||||
"obj": obj,
|
||||
"obj_identifier": obj_identifier,
|
||||
"obj_title": obj_title,
|
||||
"municipals_names": municipals_names,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
}
|
||||
@ -272,15 +290,16 @@ class Mailer:
|
||||
user_mail_address = users_to_notify.values_list("email", flat=True)
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("{} - Shared data deleted").format(obj.identifier),
|
||||
_("{} - Shared data deleted").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_shared_data_recorded(self, obj, user, municipals_names):
|
||||
def send_mail_shared_data_recorded(self, obj_identifier, obj_title, user, municipals_names):
|
||||
""" Send a mail if the user's shared data has just been unrecorded
|
||||
|
||||
Args:
|
||||
obj (): The object
|
||||
obj_identifier (str): The object identifier
|
||||
obj_title (str): The object title
|
||||
user (User): The related user
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
@ -289,7 +308,8 @@ class Mailer:
|
||||
"""
|
||||
context = {
|
||||
"user": user,
|
||||
"obj": obj,
|
||||
"obj_identifier": obj_identifier,
|
||||
"obj_title": obj_title,
|
||||
"municipals_names": municipals_names,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
}
|
||||
@ -297,15 +317,16 @@ class Mailer:
|
||||
user_mail_address = [user.email]
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("{} - Shared data recorded").format(obj.identifier),
|
||||
_("{} - Shared data recorded").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_shared_data_unrecorded(self, obj, user, municipals_names):
|
||||
def send_mail_shared_data_unrecorded(self, obj_identifier, obj_title, user, municipals_names):
|
||||
""" Send a mail if the user's shared data has just been unrecorded
|
||||
|
||||
Args:
|
||||
obj (): The object
|
||||
obj_identifier (str): The object identifier
|
||||
obj_title (str): The object title
|
||||
user (User): The related user
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
@ -314,7 +335,8 @@ class Mailer:
|
||||
"""
|
||||
context = {
|
||||
"user": user,
|
||||
"obj": obj,
|
||||
"obj_identifier": obj_identifier,
|
||||
"obj_title": obj_title,
|
||||
"municipals_names": municipals_names,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
}
|
||||
@ -322,15 +344,16 @@ class Mailer:
|
||||
user_mail_address = [user.email]
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("{} - Shared data unrecorded").format(obj.identifier),
|
||||
_("{} - Shared data unrecorded").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_shared_data_deleted(self, obj, user, municipals_names):
|
||||
def send_mail_shared_data_deleted(self, obj_identifier, obj_title, user, municipals_names):
|
||||
""" Send a mail if shared data has just been deleted
|
||||
|
||||
Args:
|
||||
obj (): The object
|
||||
obj_identifier (str): The object identifier
|
||||
obj_title (str): The object title
|
||||
user (User): The related user
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
@ -339,7 +362,8 @@ class Mailer:
|
||||
"""
|
||||
context = {
|
||||
"user": user,
|
||||
"obj": obj,
|
||||
"obj_identifier": obj_identifier,
|
||||
"obj_title": obj_title,
|
||||
"municipals_names": municipals_names,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
}
|
||||
@ -347,15 +371,16 @@ class Mailer:
|
||||
user_mail_address = [user.email]
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("{} - Shared data deleted").format(obj.identifier),
|
||||
_("{} - Shared data deleted").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_shared_data_checked(self, obj, user, municipals_names):
|
||||
def send_mail_shared_data_checked(self, obj_identifier, obj_title, user, municipals_names):
|
||||
""" Send a mail if shared data just has been checked
|
||||
|
||||
Args:
|
||||
obj (): The object
|
||||
obj_identifier (str): The object identifier
|
||||
obj_title (str): The object title
|
||||
user (User): The related user
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
@ -364,7 +389,8 @@ class Mailer:
|
||||
"""
|
||||
context = {
|
||||
"user": user,
|
||||
"obj": obj,
|
||||
"obj_identifier": obj_identifier,
|
||||
"obj_title": obj_title,
|
||||
"municipals_names": municipals_names,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
}
|
||||
@ -372,15 +398,16 @@ class Mailer:
|
||||
user_mail_address = [user.email]
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("{} - Shared data checked").format(obj.identifier),
|
||||
_("{} - Shared data checked").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_deduction_changed(self, obj, user, data_changes):
|
||||
def send_mail_deduction_changed(self, obj_identifier, obj_title, user, data_changes):
|
||||
""" Send a mail if deduction has been changed
|
||||
|
||||
Args:
|
||||
obj (): The object
|
||||
obj_identifier (str): Identifier of the main object
|
||||
obj_title (str): Title of the main object
|
||||
user (User): User to be notified
|
||||
data_changes (dict): Contains the old|new changes of the deduction changes
|
||||
|
||||
@ -390,7 +417,8 @@ class Mailer:
|
||||
"""
|
||||
context = {
|
||||
"user": user,
|
||||
"obj": obj,
|
||||
"obj_identifier": obj_identifier,
|
||||
"obj_title": obj_title,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
"data_changes": data_changes,
|
||||
}
|
||||
@ -398,7 +426,7 @@ class Mailer:
|
||||
user_mail_address = [user.email]
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("{} - Deduction changed").format(obj.identifier),
|
||||
_("{} - Deduction changed").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
@ -423,11 +451,11 @@ class Mailer:
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_resubmission(self, obj, resubmission, municipals_names):
|
||||
def send_mail_resubmission(self, obj_identifier, resubmission, municipals_names):
|
||||
""" Send a resubmission mail for a user
|
||||
|
||||
Args:
|
||||
obj (): The (resubmitted) object
|
||||
obj_identifier (str): The (resubmitted) object's identifier
|
||||
resubmission (Resubmission): The resubmission
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
@ -435,7 +463,7 @@ class Mailer:
|
||||
|
||||
"""
|
||||
context = {
|
||||
"obj": obj,
|
||||
"obj_identifier": obj_identifier,
|
||||
"resubmission": resubmission,
|
||||
"municipals_names": municipals_names,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
@ -444,7 +472,7 @@ class Mailer:
|
||||
user_mail_address = [resubmission.user.email]
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("Resubmission - {}").format(obj.identifier),
|
||||
_("Resubmission - {}").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<div>
|
||||
<h2>{% trans 'Shared data checked' %}</h2>
|
||||
<h4>{{obj.identifier}}</h4>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% trans 'Hello ' %} {{user.username}},
|
||||
@ -10,9 +10,9 @@
|
||||
<br>
|
||||
{% trans 'the following dataset has just been checked' %}
|
||||
<br>
|
||||
<a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>{{obj.title}}</strong>
|
||||
<strong>{{obj_title}}</strong>
|
||||
<br>
|
||||
<br>
|
||||
{% trans 'This entry is located in' %}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<div>
|
||||
<h2>{% trans 'Shared data checked' %}</h2>
|
||||
<h4>{{obj.identifier}}</h4>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% trans 'Hello team' %} {{team.name}},
|
||||
@ -10,9 +10,9 @@
|
||||
<br>
|
||||
{% trans 'the following dataset has just been checked' %}
|
||||
<br>
|
||||
<a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>{{obj.title}}</strong>
|
||||
<strong>{{obj_title}}</strong>
|
||||
<br>
|
||||
<br>
|
||||
{% trans 'This entry is located in' %}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<div>
|
||||
<h2>{% trans 'Shared data deleted' %}</h2>
|
||||
<h4>{{obj.identifier}}</h4>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% trans 'Hello ' %} {{user.username}},
|
||||
@ -10,9 +10,9 @@
|
||||
<br>
|
||||
{% trans 'the following dataset has just been deleted' %}
|
||||
<br>
|
||||
<strong>{{obj.identifier}}</strong>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>"{{obj.title}}"</strong>
|
||||
<strong>"{{obj_title}}"</strong>
|
||||
<br>
|
||||
<br>
|
||||
{% trans 'This entry is located in' %}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<div>
|
||||
<h2>{% trans 'Shared data deleted' %}</h2>
|
||||
<h4>{{obj.identifier}}</h4>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% trans 'Hello team' %} {{team.name}},
|
||||
@ -10,9 +10,9 @@
|
||||
<br>
|
||||
{% trans 'the following dataset has just been deleted' %}
|
||||
<br>
|
||||
<strong>{{obj.identifier}}</strong>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>"{{obj.title}}"</strong>
|
||||
<strong>"{{obj_title}}"</strong>
|
||||
<br>
|
||||
<br>
|
||||
{% trans 'This entry is located in' %}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<div>
|
||||
<h2>{% translate 'Deduction changed' %}</h2>
|
||||
<h4>{{obj.identifier}}</h4>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% translate 'Hello ' %} {{user.username}},
|
||||
@ -10,7 +10,6 @@
|
||||
<br>
|
||||
{% translate 'a deduction of this eco account has changed:' %}
|
||||
<br>
|
||||
<a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
|
||||
<br>
|
||||
<table>
|
||||
<tr>
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<div>
|
||||
<h2>{% translate 'Deduction changed' %}</h2>
|
||||
<h4>{{obj.identifier}}</h4>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% trans 'Hello team' %} {{team.name}},
|
||||
@ -10,7 +10,6 @@
|
||||
<br>
|
||||
{% translate 'a deduction of this eco account has changed:' %}
|
||||
<br>
|
||||
<a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
|
||||
<br>
|
||||
<table>
|
||||
<tr>
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<div>
|
||||
<h2>{% trans 'Shared data recorded' %}</h2>
|
||||
<h4>{{obj.identifier}}</h4>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% trans 'Hello ' %} {{user.username}},
|
||||
@ -10,9 +10,9 @@
|
||||
<br>
|
||||
{% trans 'the following dataset has just been recorded' %}
|
||||
<br>
|
||||
<a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>"{{obj.title}}"</strong>
|
||||
<strong>"{{obj_title}}"</strong>
|
||||
<br>
|
||||
<br>
|
||||
{% trans 'This entry is located in' %}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<div>
|
||||
<h2>{% trans 'Shared data recorded' %}</h2>
|
||||
<h4>{{obj.identifier}}</h4>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% trans 'Hello team' %} {{team.name}},
|
||||
@ -10,9 +10,9 @@
|
||||
<br>
|
||||
{% trans 'the following dataset has just been recorded' %}
|
||||
<br>
|
||||
<a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>"{{obj.title}}"</strong>
|
||||
<strong>"{{obj_title}}"</strong>
|
||||
<br>
|
||||
<br>
|
||||
{% trans 'This entry is located in' %}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<div>
|
||||
<h2>{% trans 'Shared data unrecorded' %}</h2>
|
||||
<h4>{{obj.identifier}}</h4>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% trans 'Hello ' %} {{user.username}},
|
||||
@ -10,9 +10,9 @@
|
||||
<br>
|
||||
{% trans 'the following dataset has just been unrecorded' %}
|
||||
<br>
|
||||
<a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>"{{obj.title}}"</strong>
|
||||
<strong>"{{obj_title}}"</strong>
|
||||
<br>
|
||||
<br>
|
||||
{% trans 'This entry is located in' %}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<div>
|
||||
<h2>{% trans 'Shared data unrecorded' %}</h2>
|
||||
<h4>{{obj.identifier}}</h4>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% trans 'Hello team' %} {{team.name}},
|
||||
@ -10,9 +10,9 @@
|
||||
<br>
|
||||
{% trans 'the following dataset has just been unrecorded' %}
|
||||
<br>
|
||||
<a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>"{{obj.title}}"</strong>
|
||||
<strong>"{{obj_title}}"</strong>
|
||||
<br>
|
||||
<br>
|
||||
{% trans 'This entry is located in' %}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<div>
|
||||
<h2>{% trans 'Resubmission' %}</h2>
|
||||
<a href="{{ obj.get_detail_url_absolute }}"><h4>{{obj.identifier}}</h4></a>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% trans 'Hello ' %} {{resubmission.user.username}},
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<div>
|
||||
<h2>{% trans 'Access shared' %}</h2>
|
||||
<h4>{{obj.identifier}}</h4>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% trans 'Hello ' %} {{user.username}},
|
||||
@ -10,9 +10,9 @@
|
||||
<br>
|
||||
{% trans 'the following dataset has just been shared with you' %}
|
||||
<br>
|
||||
<a href="{{ obj.get_detail_url_absolute }}"><h4>{{obj.identifier}}</h4></a>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>"{{obj.title}}"</strong>
|
||||
<strong>"{{obj_title}}"</strong>
|
||||
<br>
|
||||
<br>
|
||||
{% trans 'This entry is located in' %}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<div>
|
||||
<h2>{% trans 'Access shared' %}</h2>
|
||||
<h4>{{obj.identifier}}</h4>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% trans 'Hello team' %} {{team.name}},
|
||||
@ -10,9 +10,9 @@
|
||||
<br>
|
||||
{% trans 'the following dataset has just been shared with your team' %}
|
||||
<br>
|
||||
<a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>"{{obj.title}}"</strong>
|
||||
<strong>"{{obj_title}}"</strong>
|
||||
<br>
|
||||
<br>
|
||||
{% trans 'This entry is located in' %}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<div>
|
||||
<h2>{% trans 'Shared access removed' %}</h2>
|
||||
<h4>{{obj.identifier}}</h4>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% trans 'Hello ' %} {{user.username}},
|
||||
@ -10,9 +10,9 @@
|
||||
<br>
|
||||
{% trans 'your shared access, including editing, has been revoked for the dataset ' %}
|
||||
<br>
|
||||
<a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>"{{obj.title}}"</strong>
|
||||
<strong>"{{obj_title}}"</strong>
|
||||
<br>
|
||||
<br>
|
||||
{% trans 'This entry is located in' %}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<div>
|
||||
<h2>{% trans 'Shared access removed' %}</h2>
|
||||
<h4>{{obj.identifier}}</h4>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% trans 'Hello team' %} {{team.name}},
|
||||
@ -10,9 +10,9 @@
|
||||
<br>
|
||||
{% trans 'your teams shared access, including editing, has been revoked for the dataset ' %}
|
||||
<br>
|
||||
<a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>"{{obj.title}}"</strong>
|
||||
<strong>"{{obj_title}}"</strong>
|
||||
<br>
|
||||
<br>
|
||||
{% trans 'This entry is located in' %}
|
||||
|
@ -31,11 +31,12 @@ class Team(UuidModel, DeletableObjectMixin):
|
||||
self.deleted = delete_action
|
||||
self.save()
|
||||
|
||||
def send_mail_shared_access_given_team(self, obj, municipals_names):
|
||||
def send_mail_shared_access_given_team(self, obj_identifier, obj_title, municipals_names):
|
||||
""" Sends a mail to the team members in case of given shared access
|
||||
|
||||
Args:
|
||||
obj (str): The entry
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@ -45,13 +46,14 @@ class Team(UuidModel, DeletableObjectMixin):
|
||||
users_to_notify = self.users.filter(
|
||||
notifications__in=[UserNotificationEnum.NOTIFY_ON_SHARED_ACCESS_GAINED.value]
|
||||
)
|
||||
mailer.send_mail_shared_access_given_team(obj, self, users_to_notify, municipals_names)
|
||||
mailer.send_mail_shared_access_given_team(obj_identifier, obj_title, self, users_to_notify, municipals_names)
|
||||
|
||||
def send_mail_shared_access_removed(self, obj, municipals_names):
|
||||
def send_mail_shared_access_removed(self, obj_identifier, obj_title, municipals_names):
|
||||
""" Sends a mail to the team members in case of removed shared access
|
||||
|
||||
Args:
|
||||
obj (): The entry
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@ -61,13 +63,14 @@ class Team(UuidModel, DeletableObjectMixin):
|
||||
users_to_notify = self.users.filter(
|
||||
notifications__in=[UserNotificationEnum.NOTIFY_ON_SHARED_ACCESS_REMOVED.value]
|
||||
)
|
||||
mailer.send_mail_shared_access_removed_team(obj, self, users_to_notify, municipals_names)
|
||||
mailer.send_mail_shared_access_removed_team(obj_identifier, obj_title, self, users_to_notify, municipals_names)
|
||||
|
||||
def send_mail_shared_data_unrecorded(self, obj, municipals_names):
|
||||
def send_mail_shared_data_unrecorded(self, obj_identifier, obj_title, municipals_names):
|
||||
""" Sends a mail to the team members in case of unrecorded data
|
||||
|
||||
Args:
|
||||
obj (): The entry
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@ -77,13 +80,14 @@ class Team(UuidModel, DeletableObjectMixin):
|
||||
users_to_notify = self.users.filter(
|
||||
notifications__in=[UserNotificationEnum.NOTIFY_ON_SHARED_DATA_RECORDED.value]
|
||||
)
|
||||
mailer.send_mail_shared_data_unrecorded_team(obj, self, users_to_notify, municipals_names)
|
||||
mailer.send_mail_shared_data_unrecorded_team(obj_identifier, obj_title, self, users_to_notify, municipals_names)
|
||||
|
||||
def send_mail_shared_data_recorded(self, obj, municipals_names):
|
||||
def send_mail_shared_data_recorded(self, obj_identifier, obj_title, municipals_names):
|
||||
""" Sends a mail to the team members in case of unrecorded data
|
||||
|
||||
Args:
|
||||
obj (): The entry
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@ -93,13 +97,14 @@ class Team(UuidModel, DeletableObjectMixin):
|
||||
users_to_notify = self.users.filter(
|
||||
notifications__in=[UserNotificationEnum.NOTIFY_ON_SHARED_DATA_RECORDED.value]
|
||||
)
|
||||
mailer.send_mail_shared_data_recorded_team(obj, self, users_to_notify, municipals_names)
|
||||
mailer.send_mail_shared_data_recorded_team(obj_identifier, obj_title, self, users_to_notify, municipals_names)
|
||||
|
||||
def send_mail_shared_data_checked(self, obj, municipals_names):
|
||||
def send_mail_shared_data_checked(self, obj_identifier, obj_title, municipals_names):
|
||||
""" Sends a mail to the team members in case of checked data
|
||||
|
||||
Args:
|
||||
obj (): The entry
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@ -109,13 +114,14 @@ class Team(UuidModel, DeletableObjectMixin):
|
||||
users_to_notify = self.users.filter(
|
||||
notifications__in=[UserNotificationEnum.NOTIFY_ON_SHARED_DATA_CHECKED.value]
|
||||
)
|
||||
mailer.send_mail_shared_data_checked_team(obj, self, users_to_notify, municipals_names)
|
||||
mailer.send_mail_shared_data_checked_team(obj_identifier, obj_title, self, users_to_notify, municipals_names)
|
||||
|
||||
def send_mail_deduction_changed(self, obj, data_changes):
|
||||
def send_mail_deduction_changed(self, obj_identifier, obj_title, data_changes):
|
||||
""" Sends a mail to the team members in case of changed deduction values
|
||||
|
||||
Args:
|
||||
obj (): The main object
|
||||
obj_identifier (str): Identifier of the main object
|
||||
obj_title (str): Title of the main object
|
||||
data_changes (dict): Contains the old|new changes of the deduction changes
|
||||
|
||||
Returns:
|
||||
@ -125,13 +131,14 @@ class Team(UuidModel, DeletableObjectMixin):
|
||||
users_to_notify = self.users.filter(
|
||||
notifications__in=[UserNotificationEnum.NOTIFY_ON_DEDUCTION_CHANGES.value]
|
||||
)
|
||||
mailer.send_mail_deduction_changed_team(obj, self, data_changes, users_to_notify)
|
||||
mailer.send_mail_deduction_changed_team(obj_identifier, obj_title, self, data_changes, users_to_notify)
|
||||
|
||||
def send_mail_shared_data_deleted(self, obj, municipals_names):
|
||||
def send_mail_shared_data_deleted(self, obj_identifier, obj_title, municipals_names):
|
||||
""" Sends a mail to the team members in case of deleted data
|
||||
|
||||
Args:
|
||||
obj (): The entry
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@ -141,7 +148,7 @@ class Team(UuidModel, DeletableObjectMixin):
|
||||
users_to_notify = self.users.filter(
|
||||
notifications__in=[UserNotificationEnum.NOTIFY_ON_SHARED_DATA_DELETED.value]
|
||||
)
|
||||
mailer.send_mail_shared_data_deleted_team(obj, self, users_to_notify, municipals_names)
|
||||
mailer.send_mail_shared_data_deleted_team(obj_identifier, obj_title, self, users_to_notify, municipals_names)
|
||||
|
||||
def remove_user(self, user):
|
||||
""" Removes a user from the team
|
||||
|
@ -83,11 +83,12 @@ class User(AbstractUser):
|
||||
name=group
|
||||
)
|
||||
|
||||
def send_mail_shared_access_removed(self, obj, municipals_names):
|
||||
def send_mail_shared_access_removed(self, obj_identifier, obj_title, municipals_names):
|
||||
""" Sends a mail to the user in case of removed shared access
|
||||
|
||||
Args:
|
||||
obj ():
|
||||
obj_identifier ():
|
||||
obj_title ():
|
||||
municipals_names ():
|
||||
|
||||
Returns:
|
||||
@ -96,13 +97,14 @@ class User(AbstractUser):
|
||||
notification_set = self.is_notification_setting_set(UserNotificationEnum.NOTIFY_ON_SHARED_ACCESS_REMOVED)
|
||||
if notification_set:
|
||||
mailer = Mailer()
|
||||
mailer.send_mail_shared_access_removed(obj, self, municipals_names)
|
||||
mailer.send_mail_shared_access_removed(obj_identifier, obj_title, self, municipals_names)
|
||||
|
||||
def send_mail_shared_access_given(self, obj, municipals_names):
|
||||
def send_mail_shared_access_given(self, obj_identifier, obj_title, municipals_names):
|
||||
""" Sends a mail to the user in case of given shared access
|
||||
|
||||
Args:
|
||||
obj (): The entry
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@ -111,13 +113,14 @@ class User(AbstractUser):
|
||||
notification_set = self.is_notification_setting_set(UserNotificationEnum.NOTIFY_ON_SHARED_ACCESS_GAINED)
|
||||
if notification_set:
|
||||
mailer = Mailer()
|
||||
mailer.send_mail_shared_access_given(obj, self, municipals_names)
|
||||
mailer.send_mail_shared_access_given(obj_identifier, obj_title, self, municipals_names)
|
||||
|
||||
def send_mail_shared_data_recorded(self, obj, municipals_names):
|
||||
def send_mail_shared_data_recorded(self, obj_identifier, obj_title, municipals_names):
|
||||
""" Sends a mail to the user in case of shared data has been recorded
|
||||
|
||||
Args:
|
||||
obj (): The entry
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@ -126,13 +129,14 @@ class User(AbstractUser):
|
||||
notification_set = self.is_notification_setting_set(UserNotificationEnum.NOTIFY_ON_SHARED_DATA_RECORDED)
|
||||
if notification_set:
|
||||
mailer = Mailer()
|
||||
mailer.send_mail_shared_data_recorded(obj, self, municipals_names)
|
||||
mailer.send_mail_shared_data_recorded(obj_identifier, obj_title, self, municipals_names)
|
||||
|
||||
def send_mail_shared_data_unrecorded(self, obj, municipals_names):
|
||||
def send_mail_shared_data_unrecorded(self, obj_identifier, obj_title, municipals_names):
|
||||
""" Sends a mail to the user in case of shared data has been unrecorded
|
||||
|
||||
Args:
|
||||
obj (): The entry
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@ -141,13 +145,14 @@ class User(AbstractUser):
|
||||
notification_set = self.is_notification_setting_set(UserNotificationEnum.NOTIFY_ON_SHARED_DATA_RECORDED)
|
||||
if notification_set:
|
||||
mailer = Mailer()
|
||||
mailer.send_mail_shared_data_unrecorded(obj, self, municipals_names)
|
||||
mailer.send_mail_shared_data_unrecorded(obj_identifier, obj_title, self, municipals_names)
|
||||
|
||||
def send_mail_shared_data_deleted(self, obj, municipals_names):
|
||||
def send_mail_shared_data_deleted(self, obj_identifier, obj_title, municipals_names):
|
||||
""" Sends a mail to the user in case of shared data has been deleted
|
||||
|
||||
Args:
|
||||
obj (): The entry
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@ -156,13 +161,14 @@ class User(AbstractUser):
|
||||
notification_set = self.is_notification_setting_set(UserNotificationEnum.NOTIFY_ON_SHARED_DATA_DELETED)
|
||||
if notification_set:
|
||||
mailer = Mailer()
|
||||
mailer.send_mail_shared_data_deleted(obj, self, municipals_names)
|
||||
mailer.send_mail_shared_data_deleted(obj_identifier, obj_title, self, municipals_names)
|
||||
|
||||
def send_mail_shared_data_checked(self, obj, municipals_names):
|
||||
def send_mail_shared_data_checked(self, obj_identifier, obj_title, municipals_names):
|
||||
""" Sends a mail to the user in case of shared data has been deleted
|
||||
|
||||
Args:
|
||||
obj (): The entry
|
||||
obj_identifier (str): The entry identifier
|
||||
obj_title (str): The entry title
|
||||
municipals_names (iterable): List of municipals for this entry
|
||||
|
||||
Returns:
|
||||
@ -171,13 +177,14 @@ class User(AbstractUser):
|
||||
notification_set = self.is_notification_setting_set(UserNotificationEnum.NOTIFY_ON_SHARED_DATA_CHECKED)
|
||||
if notification_set:
|
||||
mailer = Mailer()
|
||||
mailer.send_mail_shared_data_checked(obj, self, municipals_names)
|
||||
mailer.send_mail_shared_data_checked(obj_identifier, obj_title, self, municipals_names)
|
||||
|
||||
def send_mail_deduction_changed(self, obj, data_changes):
|
||||
def send_mail_deduction_changed(self, obj_identifier, obj_title, data_changes):
|
||||
""" Sends a mail to the user in case of a changed deduction
|
||||
|
||||
Args:
|
||||
obj (): The object
|
||||
obj_identifier (str): Identifier of the main object
|
||||
obj_title (str): Title of the main object
|
||||
data_changes (dict): Contains the old|new changes of the deduction changes
|
||||
|
||||
Returns:
|
||||
@ -186,7 +193,7 @@ class User(AbstractUser):
|
||||
notification_set = self.is_notification_setting_set(UserNotificationEnum.NOTIFY_ON_DEDUCTION_CHANGES)
|
||||
if notification_set:
|
||||
mailer = Mailer()
|
||||
mailer.send_mail_deduction_changed(obj, self, data_changes)
|
||||
mailer.send_mail_deduction_changed(obj_identifier, obj_title, self, data_changes)
|
||||
|
||||
def get_API_token(self):
|
||||
""" Getter for an API token
|
||||
|
Loading…
Reference in New Issue
Block a user