admin: changed message display in change page

No needs for filter links, it's only useful on the listing page.
This commit is contained in:
Benjamin Dauvergne 2012-12-11 17:03:48 +01:00
parent b33e7bc73c
commit 8d17c15ca0
1 changed files with 12 additions and 2 deletions

View File

@ -22,8 +22,8 @@ class StringDataInlineAdmin(admin.TabularInline):
class JournalAdmin(admin.ModelAdmin):
list_display = ('time', 'tag', 'html_message')
list_filter = ('tag',)
fields = list_display
readonly_fields = list_display
fields = ('time', 'tag', 'html_message_no_filter')
readonly_fields = fields
inlines = (
ObjectDataInlineAdmin,
StringDataInlineAdmin,
@ -57,6 +57,16 @@ class JournalAdmin(admin.ModelAdmin):
# return ''
return '<a href="%s" class="external-link"></a>' % url
def html_message_no_filter(self, entry):
ctx = entry.message_context()
for obj_data in entry.objectdata_set.all():
key = obj_data.tag.name;
ctx[key] = ctx[key] + self.object_link(obj_data)
template = _(entry.template.content) # localize the template
return '<span>{}</span>'.format(template.format(**ctx))
html_message_no_filter.allow_tags = True
html_message_no_filter.short_description = _('Message')
def html_message(self, entry):
ctx = entry.message_context()
for obj_data in entry.objectdata_set.select_related():