1
0
Fork 1
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:
Yuri Baburov 2013-07-25 17:49:27 +00:00
parent ac0f2153c0
commit d06c64a487

View file

@ -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',