mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #7284: Include comments field in table/export for all appropriate models
This commit is contained in:
@ -12,7 +12,6 @@ from django_tables2.data import TableQuerysetData
|
||||
from django_tables2.utils import Accessor
|
||||
|
||||
from extras.models import CustomField
|
||||
from extras.utils import FeatureQuery
|
||||
from .utils import content_type_name
|
||||
from .paginator import EnhancedPaginator, get_paginate_count
|
||||
|
||||
@ -395,6 +394,28 @@ class UtilizationColumn(tables.TemplateColumn):
|
||||
return f'{value}%'
|
||||
|
||||
|
||||
class MarkdownColumn(tables.TemplateColumn):
|
||||
"""
|
||||
Render a Markdown string.
|
||||
"""
|
||||
template_code = """
|
||||
{% load helpers %}
|
||||
{% if value %}
|
||||
{{ value|render_markdown }}
|
||||
{% else %}
|
||||
—
|
||||
{% endif %}
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
template_code=self.template_code
|
||||
)
|
||||
|
||||
def value(self, value):
|
||||
return value
|
||||
|
||||
|
||||
#
|
||||
# Pagination
|
||||
#
|
||||
|
Reference in New Issue
Block a user