from django.utils.safestring import mark_safe
-class ContactAdminMeta(admin.ModelAdmin.__metaclass__):
+class ContactAdminMeta(admin.ModelAdmin.__class__):
def __getattr__(cls, name):
if name.startswith('admin_list_'):
return lambda self: ""
except BaseException, e:
return ''
else:
- return obj.body.get(field_name, '')
+ return Contact.pretty_print(obj.body.get(field_name, ''), for_html=True)
def __getattr__(self, name):
if name.startswith('admin_list_'):
# Create field getters for fields and attachments.
for k, v in instance.body.items():
- f = (lambda v: lambda self: v)(v)
+ f = (lambda v: lambda self: v)(Contact.pretty_print(v, for_html=True))
f.short_description = orig_fields[k].label if k in orig_fields else _(k)
setattr(self, "body__%s" % k, f)