netbox-ddns/netbox_ddns/template_content.py
2020-04-19 21:28:06 +02:00

27 lines
839 B
Python

from django.contrib.auth.context_processors import PermWrapper
from extras.plugins import PluginTemplateExtension
from . import tables
# noinspection PyAbstractClass
class DNSInfo(PluginTemplateExtension):
model = 'ipam.ipaddress'
def left_page(self):
"""
An info-box with the status of the DNS modifications and records
"""
extra_dns_name_table = tables.PrefixTable(list(self.context['object'].extradnsname_set.all()), orderable=False)
return (
self.render('netbox_ddns/ipaddress/dns_info.html') +
self.render('netbox_ddns/ipaddress/dns_extra.html', {
'perms': PermWrapper(self.context['request'].user),
'extra_dns_name_table': extra_dns_name_table,
})
)
template_extensions = [DNSInfo]