mirror of
https://github.com/coddingtonbear/django-mailbox.git
synced 2026-07-10 06:48: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
|
model = MessageAttachment
|
||||||
extra = 0
|
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):
|
class MessageAdmin(admin.ModelAdmin):
|
||||||
def attachment_count(self, msg):
|
def attachment_count(self, msg):
|
||||||
return msg.attachments.count()
|
return msg.attachments.count()
|
||||||
|
|
||||||
|
def Subject(self, msg):
|
||||||
|
return decode(msg.subject)
|
||||||
|
|
||||||
inlines = [
|
inlines = [
|
||||||
MessageAttachmentInline,
|
MessageAttachmentInline,
|
||||||
]
|
]
|
||||||
list_display = (
|
list_display = (
|
||||||
'subject',
|
'Subject',
|
||||||
'processed',
|
'processed',
|
||||||
'read',
|
'read',
|
||||||
'mailbox',
|
'mailbox',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue