Skip to content

Commit

Permalink
πŸ§‘β€πŸ’»(admin) add read-only fields to mailbox admin
Browse files Browse the repository at this point in the history
mark local_part and domain as read-only fields in admin,
in order to prevent mistakes/temptation. For now, if an local part
needs modification, you can simply delete/recreate the email you want.
Changing the domain is a bigger operation that cannot
be settled simply by changing it Django db.
  • Loading branch information
mjeammet committed Jan 10, 2025
1 parent 9b9aa2a commit 7d6a327
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/backend/mailbox_manager/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ class MailDomainAdmin(admin.ModelAdmin):
class MailboxAdmin(admin.ModelAdmin):
"""Admin for mailbox model."""

list_display = ("__str__", "domain", "status")
list_display = ("__str__", "domain", "status", "updated_at")
list_filter = ("status",)
search_fields = ("local_part", "domain__name")
readonly_fields = ["updated_at", "local_part", "domain"]


@admin.register(models.MailDomainAccess)
Expand Down

0 comments on commit 7d6a327

Please sign in to comment.