mirror of
https://github.com/coddingtonbear/django-mailbox.git
synced 2026-07-09 22:38:19 +02:00
Added subject decode
This commit is contained in:
parent
ac0f2153c0
commit
d06c64a487
1 changed files with 8 additions and 1 deletions
|
|
@ -44,16 +44,23 @@ class MessageAttachmentInline(admin.TabularInline):
|
|||
model = MessageAttachment
|
||||
extra = 0
|
||||
|
||||
default_charset = 'ASCII'
|
||||
import email.header
|
||||
def decode(m):
|
||||
return ''.join([ unicode(t[0], t[1] or default_charset) for t in email.header.decode_header(m) ])
|
||||
|
||||
class MessageAdmin(admin.ModelAdmin):
|
||||
def attachment_count(self, msg):
|
||||
return msg.attachments.count()
|
||||
|
||||
def Subject(self, msg):
|
||||
return decode(msg.subject)
|
||||
|
||||
inlines = [
|
||||
MessageAttachmentInline,
|
||||
]
|
||||
list_display = (
|
||||
'subject',
|
||||
'Subject',
|
||||
'processed',
|
||||
'read',
|
||||
'mailbox',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue