368_Mail_linking #370

Merged
mpeltriaux merged 3 commits from 368_Mail_linking into master 2023-12-11 13:42:51 +01:00
22 changed files with 107 additions and 34 deletions
Showing only changes of commit 8cdea88756 - Show all commits

View File

@ -8,11 +8,13 @@ Created on: 16.11.21
import shutil import shutil
from django.contrib import messages from django.contrib import messages
from django.urls import reverse
from analysis.settings import LKOMPVZVO_PUBLISH_DATE from analysis.settings import LKOMPVZVO_PUBLISH_DATE
from codelist.models import KonovaCode from codelist.models import KonovaCode
from compensation.settings import COMPENSATION_IDENTIFIER_TEMPLATE, COMPENSATION_IDENTIFIER_LENGTH, \ 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 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 user.models import User, Team
from django.db import models, transaction from django.db import models, transaction
from django.db.models import QuerySet, Sum from django.db.models import QuerySet, Sum
@ -307,6 +309,13 @@ class Compensation(AbstractCompensation, CEFMixin, CoherenceMixin, PikMixin):
def __str__(self): def __str__(self):
return "{}".format(self.identifier) 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): def save(self, *args, **kwargs):
if self.identifier is None or len(self.identifier) == 0: if self.identifier is None or len(self.identifier) == 0:
# Create new identifier is none was given # Create new identifier is none was given

View File

@ -11,6 +11,7 @@ from django.urls import reverse
from compensation.settings import ECO_ACCOUNT_IDENTIFIER_TEMPLATE, ECO_ACCOUNT_IDENTIFIER_LENGTH, \ from compensation.settings import ECO_ACCOUNT_IDENTIFIER_TEMPLATE, ECO_ACCOUNT_IDENTIFIER_LENGTH, \
ECO_ACCOUNT_LANIS_LAYER_NAME_RECORDED, ECO_ACCOUNT_LANIS_LAYER_NAME_UNRECORDED 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 konova.utils.message_templates import DEDUCTION_REMOVED, DOCUMENT_REMOVED_TEMPLATE
from django.core.validators import MinValueValidator from django.core.validators import MinValueValidator
from django.db import models from django.db import models
@ -58,6 +59,12 @@ class EcoAccount(AbstractCompensation, ShareableObjectMixin, RecordableObjectMix
def __str__(self): def __str__(self):
return f"{self.identifier} ({self.title})" 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): def save(self, *args, **kwargs):
if self.identifier is None or len(self.identifier) == 0: if self.identifier is None or len(self.identifier) == 0:
# Create new identifier if none was given # Create new identifier if none was given
@ -161,12 +168,12 @@ class EcoAccount(AbstractCompensation, ShareableObjectMixin, RecordableObjectMix
# Send mail # Send mail
shared_users = self.shared_users.values_list("id", flat=True) shared_users = self.shared_users.values_list("id", flat=True)
for user_id in shared_users: for user_id in shared_users:
celery_send_mail_deduction_changed.delay(self.id, self.__class__, user_id, data_change) celery_send_mail_deduction_changed.delay(self.id, self.get_app_object_tuple(), user_id, data_change)
# Send mail # Send mail
shared_teams = self.shared_teams.values_list("id", flat=True) shared_teams = self.shared_teams.values_list("id", flat=True)
for team_id in shared_teams: for team_id in shared_teams:
celery_send_mail_deduction_changed_team.delay(self.id, self.__class__, team_id, data_change) celery_send_mail_deduction_changed_team.delay(self.id, self.get_app_object_tuple(), team_id, data_change)
def update_deductable_rest(self): def update_deductable_rest(self):
""" """

View File

@ -19,6 +19,7 @@ from ema.settings import EMA_IDENTIFIER_LENGTH, EMA_IDENTIFIER_TEMPLATE, EMA_LAN
EMA_LANIS_LAYER_NAME_UNRECORDED EMA_LANIS_LAYER_NAME_UNRECORDED
from ema.utils.quality import EmaQualityChecker from ema.utils.quality import EmaQualityChecker
from konova.models import AbstractDocument, generate_document_file_upload_path, RecordableObjectMixin, ShareableObjectMixin 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 from konova.utils.message_templates import DATA_UNSHARED_EXPLANATION, DOCUMENT_REMOVED_TEMPLATE
@ -46,6 +47,12 @@ class Ema(AbstractCompensation, ShareableObjectMixin, RecordableObjectMixin, Pik
def __str__(self): def __str__(self):
return "{}".format(self.identifier) 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): def save(self, *args, **kwargs):
if self.identifier is None or len(self.identifier) == 0: if self.identifier is None or len(self.identifier) == 0:
# Create new identifier # Create new identifier

View File

@ -18,6 +18,7 @@ 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_RECORDED, INTERVENTION_LANIS_LAYER_NAME_UNRECORDED_OLD_ENTRY, \
INTERVENTION_LANIS_LAYER_NAME_UNRECORDED INTERVENTION_LANIS_LAYER_NAME_UNRECORDED
from intervention.tasks import celery_export_to_egon from intervention.tasks import celery_export_to_egon
from konova.sub_settings.django_settings import BASE_URL
from user.models import User from user.models import User
from django.db import models, transaction from django.db import models, transaction
from django.db.models import QuerySet from django.db.models import QuerySet
@ -69,6 +70,12 @@ class Intervention(BaseObject,
def __str__(self): def __str__(self):
return f"{self.identifier} ({self.title})" 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): def save(self, *args, **kwargs):
""" Custom save functionality """ Custom save functionality

View File

@ -117,12 +117,12 @@ class DeletableObjectMixin(models.Model):
# Send mail # Send mail
shared_users = self.shared_users.values_list("id", flat=True) shared_users = self.shared_users.values_list("id", flat=True)
for user_id in shared_users: for user_id in shared_users:
celery_send_mail_shared_data_deleted.delay(self.identifier, self.title, user_id) celery_send_mail_shared_data_deleted.delay(self.id, self.get_app_object_tuple(), user_id)
# Send mail # Send mail
shared_teams = self.shared_teams.values_list("id", flat=True) shared_teams = self.shared_teams.values_list("id", flat=True)
for team_id in shared_teams: for team_id in shared_teams:
celery_send_mail_shared_data_deleted_team.delay(self.id, self.__class__, team_id) celery_send_mail_shared_data_deleted_team.delay(self.id, self.get_app_object_tuple(), team_id)
self.save() self.save()
@ -215,6 +215,14 @@ class BaseObject(BaseResource, DeletableObjectMixin):
def get_detail_url(self): def get_detail_url(self):
raise NotImplementedError() 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): class RecordableObjectMixin(models.Model):
""" Wraps record related fields and functionality """ Wraps record related fields and functionality
@ -254,10 +262,10 @@ class RecordableObjectMixin(models.Model):
shared_teams = self.shared_teams.values_list("id", flat=True) shared_teams = self.shared_teams.values_list("id", flat=True)
for user_id in shared_users: for user_id in shared_users:
celery_send_mail_shared_data_unrecorded.delay(self.id, self.__class__, user_id) celery_send_mail_shared_data_unrecorded.delay(self.id, self.get_app_object_tuple(), user_id)
for team_id in shared_teams: for team_id in shared_teams:
celery_send_mail_shared_data_unrecorded_team.delay(self.id, self.__class__, team_id) celery_send_mail_shared_data_unrecorded_team.delay(self.id, self.get_app_object_tuple(), team_id)
return action return action
@ -284,10 +292,10 @@ class RecordableObjectMixin(models.Model):
shared_teams = self.shared_teams.values_list("id", flat=True) shared_teams = self.shared_teams.values_list("id", flat=True)
for user_id in shared_users: for user_id in shared_users:
celery_send_mail_shared_data_recorded.delay(self.id, self.__class__, user_id) celery_send_mail_shared_data_recorded.delay(self.id, self.get_app_object_tuple(), user_id)
for team_id in shared_teams: for team_id in shared_teams:
celery_send_mail_shared_data_recorded_team.delay(self.id, self.__class__, team_id) celery_send_mail_shared_data_recorded_team.delay(self.id, self.get_app_object_tuple(), team_id)
return action return action
@ -361,12 +369,12 @@ class CheckableObjectMixin(models.Model):
# Send mail # Send mail
shared_users = self.shared_users.values_list("id", flat=True) shared_users = self.shared_users.values_list("id", flat=True)
for user_id in shared_users: for user_id in shared_users:
celery_send_mail_shared_data_checked.delay(self.id, self.__class__, user_id) celery_send_mail_shared_data_checked.delay(self.id, self.get_app_object_tuple(), user_id)
# Send mail # Send mail
shared_teams = self.shared_teams.values_list("id", flat=True) shared_teams = self.shared_teams.values_list("id", flat=True)
for team_id in shared_teams: for team_id in shared_teams:
celery_send_mail_shared_data_checked_team.delay(self.id, self.__class__, team_id) celery_send_mail_shared_data_checked_team.delay(self.id, self.get_app_object_tuple(), team_id)
self.log.add(action) self.log.add(action)
return action return action
@ -550,9 +558,9 @@ class ShareableObjectMixin(models.Model):
).values_list("id", flat=True) ).values_list("id", flat=True)
for team_id in new_teams: for team_id in new_teams:
celery_send_mail_shared_access_given_team.delay(self.id, self.__class__, team_id) celery_send_mail_shared_access_given_team.delay(self.id, self.get_app_object_tuple(), team_id)
for team_id in removed_teams: for team_id in removed_teams:
celery_send_mail_shared_access_removed_team.delay(self.id, self.__class__, team_id) celery_send_mail_shared_access_removed_team.delay(self.id, self.get_app_object_tuple(), team_id)
self.share_with_team_list(accessing_teams) self.share_with_team_list(accessing_teams)
@ -579,9 +587,9 @@ class ShareableObjectMixin(models.Model):
# Send mails # Send mails
for user_id in removed_users: for user_id in removed_users:
celery_send_mail_shared_access_removed.delay(self.id, self.__class__, user_id) celery_send_mail_shared_access_removed.delay(self.id, self.get_app_object_tuple(), user_id)
for user_id in new_users: for user_id in new_users:
celery_send_mail_shared_access_given.delay(self.id, self.__class__, user_id) celery_send_mail_shared_access_given.delay(self.id, self.get_app_object_tuple(), user_id)
# Set new shared users # Set new shared users
self.share_with_user_list(accessing_users) self.share_with_user_list(accessing_users)
@ -644,7 +652,7 @@ class ShareableObjectMixin(models.Model):
self.share_with_user_list(cleaned_users) self.share_with_user_list(cleaned_users)
for user in default_users: for user in default_users:
celery_send_mail_shared_access_removed.delay(self.id, self.__class__, user.id) celery_send_mail_shared_access_removed.delay(self.id, self.get_app_object_tuple(), user.id)
class GeoReferencedMixin(models.Model): class GeoReferencedMixin(models.Model):
@ -736,6 +744,5 @@ class ResubmitableObjectMixin(models.Model):
""" """
resubmissions = self.resubmissions.all() resubmissions = self.resubmissions.all()
municipal_names = list(self.geometry.get_underlying_municipals().values_list("name", flat=True))
for resubmission in resubmissions: for resubmission in resubmissions:
resubmission.send_resubmission_mail(self.identifier, municipal_names) resubmission.send_resubmission_mail(self.id, self.get_app_object_tuple())

View File

@ -6,6 +6,7 @@ Created on: 15.08.22
""" """
from dateutil.utils import today from dateutil.utils import today
from django.apps import apps
from django.db import models from django.db import models
from konova.models import BaseResource from konova.models import BaseResource
@ -31,16 +32,20 @@ class Resubmission(BaseResource):
help_text="Optional comment for the user itself" help_text="Optional comment for the user itself"
) )
def send_resubmission_mail(self, obj_identifier, municipal_names): def send_resubmission_mail(self, obj_id, obj_class):
""" Sends a resubmission mail """ 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() _today = today().date()
resubmission_handled = _today.__ge__(self.resubmit_on) and self.resubmission_sent resubmission_handled = _today.__ge__(self.resubmit_on) and self.resubmission_sent
if resubmission_handled: if resubmission_handled:
return return
mailer = Mailer() mailer = Mailer()
mailer.send_mail_resubmission(obj_identifier, self, municipal_names) mailer.send_mail_resubmission(obj, self, municipal_names)
self.resubmission_sent = True self.resubmission_sent = True
self.save() self.save()

View File

@ -37,6 +37,8 @@ ADMINS = [
('KSP-Servicestelle', 'ksp-servicestelle@sgdnord.rlp.de'), ('KSP-Servicestelle', 'ksp-servicestelle@sgdnord.rlp.de'),
] ]
BASE_URL = "http://localhost:8001"
ALLOWED_HOSTS = [ ALLOWED_HOSTS = [
"127.0.0.1", "127.0.0.1",
"localhost", "localhost",

View File

@ -1,6 +1,7 @@
from time import sleep from time import sleep
from celery import shared_task from celery import shared_task
from django.apps import apps
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
@ -28,6 +29,8 @@ def celery_update_parcels(geometry_id: str, recheck: bool = True):
def celery_send_mail_shared_access_removed(obj_id, obj_class, user_id=None): def celery_send_mail_shared_access_removed(obj_id, obj_class, user_id=None):
from user.models import User from user.models import User
user = User.objects.get(id=user_id) 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) obj = obj_class.objects.get(id=obj_id)
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True)) municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
@ -38,6 +41,8 @@ def celery_send_mail_shared_access_removed(obj_id, obj_class, user_id=None):
def celery_send_mail_shared_access_given(obj_id, obj_class, user_id=None): def celery_send_mail_shared_access_given(obj_id, obj_class, user_id=None):
from user.models import User from user.models import User
user = User.objects.get(id=user_id) 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) obj = obj_class.objects.get(id=obj_id)
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True)) municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
@ -48,6 +53,8 @@ def celery_send_mail_shared_access_given(obj_id, obj_class, user_id=None):
def celery_send_mail_shared_access_removed_team(obj_id, obj_class, team_id=None): def celery_send_mail_shared_access_removed_team(obj_id, obj_class, team_id=None):
from user.models import Team from user.models import Team
team = Team.objects.get(id=team_id) 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) obj = obj_class.objects.get(id=obj_id)
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True)) municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
@ -58,6 +65,8 @@ def celery_send_mail_shared_access_removed_team(obj_id, obj_class, team_id=None)
def celery_send_mail_shared_access_given_team(obj_id, obj_class, team_id=None): def celery_send_mail_shared_access_given_team(obj_id, obj_class, team_id=None):
from user.models import Team from user.models import Team
team = Team.objects.get(id=team_id) 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) obj = obj_class.objects.get(id=obj_id)
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True)) municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
@ -68,6 +77,8 @@ def celery_send_mail_shared_access_given_team(obj_id, obj_class, team_id=None):
def celery_send_mail_shared_data_recorded(obj_id, obj_class, user_id=None): def celery_send_mail_shared_data_recorded(obj_id, obj_class, user_id=None):
from user.models import User from user.models import User
user = User.objects.get(id=user_id) 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) obj = obj_class.objects.get(id=obj_id)
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True)) municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
@ -78,6 +89,8 @@ def celery_send_mail_shared_data_recorded(obj_id, obj_class, user_id=None):
def celery_send_mail_shared_data_unrecorded(obj_id, obj_class, user_id=None): def celery_send_mail_shared_data_unrecorded(obj_id, obj_class, user_id=None):
from user.models import User from user.models import User
user = User.objects.get(id=user_id) 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) obj = obj_class.objects.get(id=obj_id)
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True)) municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
@ -88,6 +101,8 @@ def celery_send_mail_shared_data_unrecorded(obj_id, obj_class, user_id=None):
def celery_send_mail_shared_data_recorded_team(obj_id, obj_class, team_id=None): def celery_send_mail_shared_data_recorded_team(obj_id, obj_class, team_id=None):
from user.models import Team from user.models import Team
team = Team.objects.get(id=team_id) 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) obj = obj_class.objects.get(id=obj_id)
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True)) municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
@ -98,6 +113,8 @@ def celery_send_mail_shared_data_recorded_team(obj_id, obj_class, team_id=None):
def celery_send_mail_shared_data_unrecorded_team(obj_id, obj_class, team_id=None): def celery_send_mail_shared_data_unrecorded_team(obj_id, obj_class, team_id=None):
from user.models import Team from user.models import Team
team = Team.objects.get(id=team_id) 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) obj = obj_class.objects.get(id=obj_id)
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True)) municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
@ -108,6 +125,8 @@ def celery_send_mail_shared_data_unrecorded_team(obj_id, obj_class, team_id=None
def celery_send_mail_shared_data_deleted(obj_id, obj_class, user_id=None): def celery_send_mail_shared_data_deleted(obj_id, obj_class, user_id=None):
from user.models import User from user.models import User
user = User.objects.get(id=user_id) 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) obj = obj_class.objects.get(id=obj_id)
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True)) municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
@ -118,6 +137,8 @@ def celery_send_mail_shared_data_deleted(obj_id, obj_class, user_id=None):
def celery_send_mail_shared_data_checked(obj_id, obj_class, user_id=None): def celery_send_mail_shared_data_checked(obj_id, obj_class, user_id=None):
from user.models import User from user.models import User
user = User.objects.get(id=user_id) 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) obj = obj_class.objects.get(id=obj_id)
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True)) municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
@ -128,6 +149,8 @@ def celery_send_mail_shared_data_checked(obj_id, obj_class, user_id=None):
def celery_send_mail_shared_data_deleted_team(obj_id, obj_class, team_id=None): def celery_send_mail_shared_data_deleted_team(obj_id, obj_class, team_id=None):
from user.models import Team from user.models import Team
team = Team.objects.get(id=team_id) 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) obj = obj_class.objects.get(id=obj_id)
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True)) municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
@ -138,6 +161,8 @@ def celery_send_mail_shared_data_deleted_team(obj_id, obj_class, team_id=None):
def celery_send_mail_shared_data_checked_team(obj_id, obj_class, team_id=None): def celery_send_mail_shared_data_checked_team(obj_id, obj_class, team_id=None):
from user.models import Team from user.models import Team
team = Team.objects.get(id=team_id) 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) obj = obj_class.objects.get(id=obj_id)
municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True)) municipals_names = list(obj.geometry.get_underlying_municipals().values_list("name", flat=True))
@ -148,6 +173,8 @@ def celery_send_mail_shared_data_checked_team(obj_id, obj_class, team_id=None):
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_id, obj_class, team_id=None, data_changes=None):
from user.models import Team from user.models import Team
team = Team.objects.get(id=team_id) 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) obj = obj_class.objects.get(id=obj_id)
team.send_mail_deduction_changed(obj, data_changes) team.send_mail_deduction_changed(obj, data_changes)
@ -156,6 +183,8 @@ def celery_send_mail_deduction_changed_team(obj_id, obj_class, team_id=None, dat
def celery_send_mail_deduction_changed(obj_id, obj_class, user_id=None, data_changes=None): def celery_send_mail_deduction_changed(obj_id, obj_class, user_id=None, data_changes=None):
from user.models import User from user.models import User
user = User.objects.get(id=user_id) 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) obj = obj_class.objects.get(id=obj_id)
user.send_mail_deduction_changed(obj, data_changes) user.send_mail_deduction_changed(obj, data_changes)

View File

@ -193,9 +193,7 @@ class ResubmissionTestCase(BaseTestCase):
self.assertFalse(resubmission.resubmission_sent) self.assertFalse(resubmission.resubmission_sent)
resubmission.send_resubmission_mail( resubmission.send_resubmission_mail(
self.intervention.identifier, self.intervention.id,
[ self.intervention.get_app_object_tuple()
"Test_municipal_1"
],
) )
self.assertTrue(resubmission.resubmission_sent) self.assertTrue(resubmission.resubmission_sent)

View File

@ -10,7 +10,7 @@
<br> <br>
{% trans 'the following dataset has just been checked' %} {% trans 'the following dataset has just been checked' %}
<br> <br>
<strong>{{obj.identifier}}</strong> <a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
<br> <br>
<strong>{{obj.title}}</strong> <strong>{{obj.title}}</strong>
<br> <br>

View File

@ -10,7 +10,7 @@
<br> <br>
{% trans 'the following dataset has just been checked' %} {% trans 'the following dataset has just been checked' %}
<br> <br>
<strong>{{obj.identifier}}</strong> <a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
<br> <br>
<strong>{{obj.title}}</strong> <strong>{{obj.title}}</strong>
<br> <br>

View File

@ -10,6 +10,7 @@
<br> <br>
{% translate 'a deduction of this eco account has changed:' %} {% translate 'a deduction of this eco account has changed:' %}
<br> <br>
<a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
<br> <br>
<table> <table>
<tr> <tr>

View File

@ -10,6 +10,7 @@
<br> <br>
{% translate 'a deduction of this eco account has changed:' %} {% translate 'a deduction of this eco account has changed:' %}
<br> <br>
<a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
<br> <br>
<table> <table>
<tr> <tr>

View File

@ -10,7 +10,7 @@
<br> <br>
{% trans 'the following dataset has just been recorded' %} {% trans 'the following dataset has just been recorded' %}
<br> <br>
<strong>{{obj.identifier}}</strong> <a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
<br> <br>
<strong>"{{obj.title}}"</strong> <strong>"{{obj.title}}"</strong>
<br> <br>

View File

@ -10,7 +10,7 @@
<br> <br>
{% trans 'the following dataset has just been recorded' %} {% trans 'the following dataset has just been recorded' %}
<br> <br>
<strong>{{obj.identifier}}</strong> <a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
<br> <br>
<strong>"{{obj.title}}"</strong> <strong>"{{obj.title}}"</strong>
<br> <br>

View File

@ -10,7 +10,7 @@
<br> <br>
{% trans 'the following dataset has just been unrecorded' %} {% trans 'the following dataset has just been unrecorded' %}
<br> <br>
<strong>{{obj.identifier}}</strong> <a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
<br> <br>
<strong>"{{obj.title}}"</strong> <strong>"{{obj.title}}"</strong>
<br> <br>

View File

@ -10,7 +10,7 @@
<br> <br>
{% trans 'the following dataset has just been unrecorded' %} {% trans 'the following dataset has just been unrecorded' %}
<br> <br>
<strong>{{obj.identifier}}</strong> <a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
<br> <br>
<strong>"{{obj.title}}"</strong> <strong>"{{obj.title}}"</strong>
<br> <br>

View File

@ -2,7 +2,7 @@
<div> <div>
<h2>{% trans 'Resubmission' %}</h2> <h2>{% trans 'Resubmission' %}</h2>
<h4>{{obj.identifier}}</h4> <a href="{{ obj.get_detail_url_absolute }}"><h4>{{obj.identifier}}</h4></a>
<hr> <hr>
<article> <article>
{% trans 'Hello ' %} {{resubmission.user.username}}, {% trans 'Hello ' %} {{resubmission.user.username}},

View File

@ -10,7 +10,7 @@
<br> <br>
{% trans 'the following dataset has just been shared with you' %} {% trans 'the following dataset has just been shared with you' %}
<br> <br>
<strong>{{obj.identifier}}</strong> <a href="{{ obj.get_detail_url_absolute }}"><h4>{{obj.identifier}}</h4></a>
<br> <br>
<strong>"{{obj.title}}"</strong> <strong>"{{obj.title}}"</strong>
<br> <br>

View File

@ -10,7 +10,7 @@
<br> <br>
{% trans 'the following dataset has just been shared with your team' %} {% trans 'the following dataset has just been shared with your team' %}
<br> <br>
<strong>{{obj.identifier}}</strong> <a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
<br> <br>
<strong>"{{obj.title}}"</strong> <strong>"{{obj.title}}"</strong>
<br> <br>

View File

@ -10,7 +10,7 @@
<br> <br>
{% trans 'your shared access, including editing, has been revoked for the dataset ' %} {% trans 'your shared access, including editing, has been revoked for the dataset ' %}
<br> <br>
<strong>{{obj.identifier}}</strong> <a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
<br> <br>
<strong>"{{obj.title}}"</strong> <strong>"{{obj.title}}"</strong>
<br> <br>

View File

@ -10,7 +10,7 @@
<br> <br>
{% trans 'your teams shared access, including editing, has been revoked for the dataset ' %} {% trans 'your teams shared access, including editing, has been revoked for the dataset ' %}
<br> <br>
<strong>{{obj.identifier}}</strong> <a href="{{ obj.get_detail_url_absolute }}"><strong>{{obj.identifier}}</strong></a>
<br> <br>
<strong>"{{obj.title}}"</strong> <strong>"{{obj.title}}"</strong>
<br> <br>