Skip to content

Commit

Permalink
Show code in admin
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Apr 29, 2024
1 parent 234a9ee commit 5c14b1f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
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/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

0 comments on commit 5c14b1f

Please sign in to comment.