Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(emails): TemplateTransactional : ajout de la source Django #1173

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lemarche/conversations/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def data_display(self, conversation: Conversation = None):

@admin.register(TemplateTransactional, site=admin_site)
class TemplateTransactionalAdmin(admin.ModelAdmin):
list_display = ["id", "name", "mailjet_id", "brevo_id", "source", "is_active", "created_at", "updated_at"]
list_display = ["id", "name", "code", "mailjet_id", "brevo_id", "source", "is_active", "created_at", "updated_at"]
search_fields = ["id", "name", "code", "mailjet_id", "brevo_id"]

readonly_fields = ["code", "email_subject", "email_from_email", "email_from_name", "created_at", "updated_at"]
Expand Down
2 changes: 2 additions & 0 deletions lemarche/conversations/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

SOURCE_MAILJET = "MAILJET"
SOURCE_BREVO = "BREVO"
SOURCE_DJANGO = "DJANGO"

SOURCE_CHOICES = (
(SOURCE_MAILJET, "Mailjet"),
(SOURCE_BREVO, "Brevo"),
(SOURCE_DJANGO, "Django"),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 4.2.9 on 2024-04-29 13:28

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("conversations", "0013_templatetransactional_email_fields"),
]

operations = [
migrations.AlterField(
model_name="templatetransactional",
name="source",
field=models.CharField(
blank=True,
choices=[("MAILJET", "Mailjet"), ("BREVO", "Brevo"), ("DJANGO", "Django")],
max_length=20,
verbose_name="Source",
),
),
]
2 changes: 2 additions & 0 deletions lemarche/conversations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ class Meta:
verbose_name_plural = "Templates transactionnels"

def __str__(self):
if self.code:
return f"{self.name} ({self.code})"
return self.name

@property
Expand Down
Loading