-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #975 from maykinmedia/feature/2024-email-notif-dif…
…ferent-types ✨ [#2024] Split email templates for zaak status/document notification
- Loading branch information
Showing
6 changed files
with
129 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/open_inwoner/openzaak/migrations/0042_case_notification_mail_template_split.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Generated by Django 3.2.23 on 2024-01-19 15:02 | ||
|
||
from django.db import migrations | ||
|
||
|
||
def split_case_notification_mail_template(apps, schema_editor): | ||
""" | ||
Split the `case_notification` email template into two separate templates, one for | ||
status notifications and one for document notifications | ||
""" | ||
MailTemplate = apps.get_model("mail_editor", "MailTemplate") | ||
|
||
case_notification_template = MailTemplate.objects.filter( | ||
template_type="case_notification" | ||
).first() | ||
|
||
if case_notification_template: | ||
case_notification_template.template_type = "case_status_notification" | ||
case_notification_template.save() | ||
|
||
case_notification_template.pk = None | ||
case_notification_template.template_type = "case_document_notification" | ||
case_notification_template.save() | ||
|
||
|
||
def join_case_notification_mail_template(apps, schema_editor): | ||
MailTemplate = apps.get_model("mail_editor", "MailTemplate") | ||
|
||
case_notification_template = MailTemplate.objects.get( | ||
template_type="case_status_notification" | ||
) | ||
MailTemplate.objects.get(template_type="case_document_notification").delete() | ||
|
||
case_notification_template.template_type = "case_notification" | ||
case_notification_template.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("mail_editor", "0001_initial"), | ||
("openzaak", "0041_configuration_cases_button"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
split_case_notification_mail_template, join_case_notification_mail_template | ||
) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters