Created
December 8, 2016 19:00
-
-
Save linuxsimba/0327b5c3e0a745925d18e0d44dd74966 to your computer and use it in GitHub Desktop.
add ticketing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/netbox/dcim/tables.py b/netbox/dcim/tables.py | |
| index 94d359a..d5af207 100644 | |
| --- a/netbox/dcim/tables.py | |
| +++ b/netbox/dcim/tables.py | |
| @@ -75,6 +75,13 @@ UTILIZATION_GRAPH = """ | |
| {% utilization_graph value %} | |
| """ | |
| +CUSTOM_FIELDS = """ | |
| +{% for field,value in record.get_custom_fields.items %} | |
| + {% if value %} | |
| + <div><div><strong>{{ field }}</strong></div><div>{{ value }}</div></div> | |
| + {% endif %} | |
| +{% endfor %} | |
| +""" | |
| # | |
| # Sites | |
| @@ -312,16 +319,17 @@ class DeviceTable(BaseTable): | |
| name = tables.TemplateColumn(template_code=DEVICE_LINK, verbose_name='Name') | |
| tenant = tables.LinkColumn('tenancy:tenant', args=[Accessor('tenant.slug')], verbose_name='Tenant') | |
| site = tables.Column(accessor=Accessor('rack.site'), verbose_name='Site') | |
| - rack = tables.LinkColumn('dcim:rack', args=[Accessor('rack.pk')], verbose_name='Rack') | |
| + # rack = tables.LinkColumn('dcim:rack', args=[Accessor('rack.pk')], verbose_name='Rack') | |
| device_role = tables.TemplateColumn(DEVICE_ROLE, verbose_name='Role') | |
| device_type = tables.LinkColumn('dcim:devicetype', args=[Accessor('device_type.pk')], verbose_name='Type', | |
| text=lambda record: record.device_type.full_name) | |
| primary_ip = tables.TemplateColumn(orderable=False, verbose_name='IP Address', | |
| template_code="{{ record.primary_ip.address.ip }}") | |
| - | |
| + custom_fields = tables.TemplateColumn(orderable=True, verbose_name='Custom Fields', | |
| + template_code=CUSTOM_FIELDS) | |
| class Meta(BaseTable.Meta): | |
| model = Device | |
| - fields = ('pk', 'name', 'status', 'tenant', 'site', 'rack', 'device_role', 'device_type', 'primary_ip') | |
| ice_type', 'primary_ip', 'custom_fields'), 'tenant', 'site', 'device_role', 'dev--More-- | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment