1
0
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:
jeremystretch
2021-09-17 12:04:22 -04:00
parent e67c965180
commit 16d8981a3f
11 changed files with 60 additions and 22 deletions

View File

@ -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
#