mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 02:48:38 -06:00
Include attributes column for profiles
This commit is contained in:
parent
1be9209b04
commit
9f16e434f7
@ -3,7 +3,7 @@ import django_tables2 as tables
|
|||||||
|
|
||||||
from dcim.models import Module, ModuleType, ModuleTypeProfile
|
from dcim.models import Module, ModuleType, ModuleTypeProfile
|
||||||
from netbox.tables import NetBoxTable, columns
|
from netbox.tables import NetBoxTable, columns
|
||||||
from .template_code import WEIGHT
|
from .template_code import MODULETYPEPROFILE_ATTRIBUTES, WEIGHT
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'ModuleTable',
|
'ModuleTable',
|
||||||
@ -17,6 +17,12 @@ class ModuleTypeProfileTable(NetBoxTable):
|
|||||||
verbose_name=_('Name'),
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
|
attributes = columns.TemplateColumn(
|
||||||
|
template_code=MODULETYPEPROFILE_ATTRIBUTES,
|
||||||
|
accessor=tables.A('schema__properties'),
|
||||||
|
orderable=False,
|
||||||
|
verbose_name=_('Attributes')
|
||||||
|
)
|
||||||
comments = columns.MarkdownColumn(
|
comments = columns.MarkdownColumn(
|
||||||
verbose_name=_('Comments'),
|
verbose_name=_('Comments'),
|
||||||
)
|
)
|
||||||
@ -30,7 +36,7 @@ class ModuleTypeProfileTable(NetBoxTable):
|
|||||||
'pk', 'id', 'name', 'description', 'comments', 'tags', 'created', 'last_updated',
|
'pk', 'id', 'name', 'description', 'comments', 'tags', 'created', 'last_updated',
|
||||||
)
|
)
|
||||||
default_columns = (
|
default_columns = (
|
||||||
'pk', 'name', 'description',
|
'pk', 'name', 'description', 'attributes',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -568,3 +568,7 @@ MODULEBAY_BUTTONS = """
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
MODULETYPEPROFILE_ATTRIBUTES = """
|
||||||
|
{% if value %}{% for attr in value %}{{ attr }}{% if not forloop.last %}, {% endif %}{% endfor %}{% endif %}
|
||||||
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user