Skip to content

Commit

Permalink
Emails : ajout de quelques champs de configuration de l'e-mail dans l…
Browse files Browse the repository at this point in the history
…es templates (#1024)

* TemplateTransactional: new fields describing email content

* Add to admin
  • Loading branch information
raphodn authored Jan 9, 2024
1 parent ba500d6 commit 1646a33
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
9 changes: 8 additions & 1 deletion lemarche/conversations/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,11 @@ class TemplateTransactionalAdmin(admin.ModelAdmin):
list_display = ["id", "name", "mailjet_id", "brevo_id", "source", "is_active", "created_at", "updated_at"]
search_fields = ["id", "name", "code", "mailjet_id", "brevo_id"]

readonly_fields = ["code", "created_at", "updated_at"]
readonly_fields = ["code", "email_subject", "email_from_email", "email_from_name", "created_at", "updated_at"]

fieldsets = (
(None, {"fields": ("name", "code", "description")}),
("Paramètres de l'e-mail", {"fields": ("email_subject", "email_from_email", "email_from_name")}),
("Paramètres d'envoi", {"fields": ("mailjet_id", "brevo_id", "source", "is_active")}),
("Dates", {"fields": ("created_at", "updated_at")}),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 4.2.2 on 2023-12-19 13:41

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("conversations", "0012_templatetransactional"),
]

operations = [
migrations.AddField(
model_name="templatetransactional",
name="email_from_email",
field=models.EmailField(
blank=True, max_length=254, null=True, verbose_name="E-mail : expéditeur (e-mail)"
),
),
migrations.AddField(
model_name="templatetransactional",
name="email_from_name",
field=models.CharField(blank=True, max_length=255, null=True, verbose_name="E-mail : expéditeur (nom)"),
),
migrations.AddField(
model_name="templatetransactional",
name="email_subject",
field=models.CharField(blank=True, max_length=255, null=True, verbose_name="E-mail : objet"),
),
]
6 changes: 5 additions & 1 deletion lemarche/conversations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,15 @@ class TemplateTransactional(models.Model):
verbose_name="Nom technique", max_length=255, unique=True, db_index=True, blank=True, null=True
)
description = models.TextField(verbose_name="Description", blank=True)

email_subject = models.CharField(verbose_name="E-mail : objet", max_length=255, blank=True, null=True)
email_from_email = models.EmailField(verbose_name="E-mail : expéditeur (e-mail)", blank=True, null=True)
email_from_name = models.CharField(verbose_name="E-mail : expéditeur (nom)", max_length=255, blank=True, null=True)

mailjet_id = models.IntegerField(
verbose_name="Identifiant Mailjet", unique=True, db_index=True, blank=True, null=True
)
brevo_id = models.IntegerField(verbose_name="Identifiant Brevo", unique=True, db_index=True, blank=True, null=True)

source = models.CharField(
verbose_name="Source", max_length=20, choices=conversation_constants.SOURCE_CHOICES, blank=True
)
Expand Down

0 comments on commit 1646a33

Please sign in to comment.