From d276f7e9a96f362df6ddcc70cd0c94066e50d275 Mon Sep 17 00:00:00 2001 From: Adam Coddington Date: Wed, 31 Dec 2014 09:40:36 -0600 Subject: [PATCH] Adding envelope headers to the Admin interface. --- django_mailbox/admin.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/django_mailbox/admin.py b/django_mailbox/admin.py index aa77b57..bc3c25a 100644 --- a/django_mailbox/admin.py +++ b/django_mailbox/admin.py @@ -64,6 +64,12 @@ class MessageAdmin(admin.ModelAdmin): def subject(self, msg): return convert_header_to_unicode(msg.subject) + def envelope_headers(self, msg): + email = msg.get_email_object() + return '\n'.join( + [('%s: %s' % (h, v)) for h, v in email.items()] + ) + inlines = [ MessageAttachmentInline, ] @@ -89,6 +95,7 @@ class MessageAdmin(admin.ModelAdmin): 'in_reply_to', ) readonly_fields = ( + 'envelope_headers', 'text', 'html', )