1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Add Markdown support for JournalEntry comments

This commit is contained in:
Jeremy Stretch
2021-03-29 09:43:21 -04:00
parent ab612c1ca6
commit 0fae7504b3
3 changed files with 30 additions and 30 deletions

View File

@ -103,32 +103,6 @@ class ObjectChangeTable(BaseTable):
fields = ('time', 'user_name', 'action', 'changed_object_type', 'object_repr', 'request_id')
class JournalEntryTable(BaseTable):
pk = ToggleColumn()
created = tables.DateTimeColumn(
format=settings.SHORT_DATETIME_FORMAT
)
assigned_object_type = ContentTypeColumn(
verbose_name='Object type'
)
assigned_object = tables.Column(
linkify=True,
orderable=False,
verbose_name='Object'
)
kind = ChoiceFieldColumn()
actions = ButtonsColumn(
model=JournalEntry,
buttons=('edit', 'delete')
)
class Meta(BaseTable.Meta):
model = JournalEntry
fields = (
'pk', 'created', 'created_by', 'assigned_object_type', 'assigned_object', 'kind', 'comments', 'actions'
)
class ObjectJournalTable(BaseTable):
"""
Used for displaying a set of JournalEntries within the context of a single object.
@ -137,6 +111,9 @@ class ObjectJournalTable(BaseTable):
format=settings.SHORT_DATETIME_FORMAT
)
kind = ChoiceFieldColumn()
comments = tables.TemplateColumn(
template_code='{% load helpers %}{{ value|render_markdown }}'
)
actions = ButtonsColumn(
model=JournalEntry,
buttons=('edit', 'delete')
@ -145,3 +122,21 @@ class ObjectJournalTable(BaseTable):
class Meta(BaseTable.Meta):
model = JournalEntry
fields = ('created', 'created_by', 'kind', 'comments', 'actions')
class JournalEntryTable(ObjectJournalTable):
pk = ToggleColumn()
assigned_object_type = ContentTypeColumn(
verbose_name='Object type'
)
assigned_object = tables.Column(
linkify=True,
orderable=False,
verbose_name='Object'
)
class Meta(BaseTable.Meta):
model = JournalEntry
fields = (
'pk', 'created', 'created_by', 'assigned_object_type', 'assigned_object', 'kind', 'comments', 'actions'
)