netbox-plugin-dns 0.21.4__py3-none-any.whl → 1.4.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- netbox_dns/__init__.py +106 -41
- netbox_dns/api/field_serializers.py +25 -0
- netbox_dns/api/nested_serializers.py +95 -52
- netbox_dns/api/serializers.py +14 -296
- netbox_dns/api/serializers_/__init__.py +0 -0
- netbox_dns/api/serializers_/dnssec_key_template.py +69 -0
- netbox_dns/api/serializers_/dnssec_policy.py +165 -0
- netbox_dns/api/serializers_/nameserver.py +56 -0
- netbox_dns/api/serializers_/prefix.py +18 -0
- netbox_dns/api/serializers_/record.py +105 -0
- netbox_dns/api/serializers_/record_template.py +71 -0
- netbox_dns/api/serializers_/registrar.py +45 -0
- netbox_dns/api/serializers_/registration_contact.py +50 -0
- netbox_dns/api/serializers_/view.py +81 -0
- netbox_dns/api/serializers_/zone.py +247 -0
- netbox_dns/api/serializers_/zone_template.py +157 -0
- netbox_dns/api/urls.py +13 -2
- netbox_dns/api/views.py +96 -58
- netbox_dns/choices/__init__.py +4 -0
- netbox_dns/choices/dnssec_key_template.py +67 -0
- netbox_dns/choices/dnssec_policy.py +40 -0
- netbox_dns/choices/record.py +104 -0
- netbox_dns/choices/utilities.py +4 -0
- netbox_dns/choices/zone.py +119 -0
- netbox_dns/fields/__init__.py +4 -0
- netbox_dns/fields/address.py +22 -16
- netbox_dns/fields/choice_array.py +33 -0
- netbox_dns/fields/ipam.py +15 -0
- netbox_dns/fields/network.py +42 -18
- netbox_dns/fields/rfc2317.py +97 -0
- netbox_dns/fields/timeperiod.py +33 -0
- netbox_dns/filters.py +7 -0
- netbox_dns/filtersets/__init__.py +12 -0
- netbox_dns/filtersets/dnssec_key_template.py +57 -0
- netbox_dns/filtersets/dnssec_policy.py +101 -0
- netbox_dns/filtersets/nameserver.py +46 -0
- netbox_dns/filtersets/record.py +135 -0
- netbox_dns/filtersets/record_template.py +59 -0
- netbox_dns/{filters → filtersets}/registrar.py +8 -1
- netbox_dns/{filters/contact.py → filtersets/registration_contact.py} +9 -3
- netbox_dns/filtersets/view.py +45 -0
- netbox_dns/filtersets/zone.py +254 -0
- netbox_dns/filtersets/zone_template.py +165 -0
- netbox_dns/forms/__init__.py +5 -1
- netbox_dns/forms/dnssec_key_template.py +250 -0
- netbox_dns/forms/dnssec_policy.py +654 -0
- netbox_dns/forms/nameserver.py +121 -27
- netbox_dns/forms/record.py +215 -104
- netbox_dns/forms/record_template.py +285 -0
- netbox_dns/forms/registrar.py +108 -31
- netbox_dns/forms/registration_contact.py +282 -0
- netbox_dns/forms/view.py +331 -20
- netbox_dns/forms/zone.py +769 -373
- netbox_dns/forms/zone_template.py +463 -0
- netbox_dns/graphql/__init__.py +25 -22
- netbox_dns/graphql/enums.py +41 -0
- netbox_dns/graphql/filter_lookups.py +13 -0
- netbox_dns/graphql/filters/__init__.py +12 -0
- netbox_dns/graphql/filters/dnssec_key_template.py +63 -0
- netbox_dns/graphql/filters/dnssec_policy.py +124 -0
- netbox_dns/graphql/filters/nameserver.py +32 -0
- netbox_dns/graphql/filters/record.py +89 -0
- netbox_dns/graphql/filters/record_template.py +55 -0
- netbox_dns/graphql/filters/registrar.py +30 -0
- netbox_dns/graphql/filters/registration_contact.py +27 -0
- netbox_dns/graphql/filters/view.py +28 -0
- netbox_dns/graphql/filters/zone.py +147 -0
- netbox_dns/graphql/filters/zone_template.py +97 -0
- netbox_dns/graphql/schema.py +89 -7
- netbox_dns/graphql/types.py +355 -0
- netbox_dns/locale/de/LC_MESSAGES/django.mo +0 -0
- netbox_dns/locale/en/LC_MESSAGES/django.mo +0 -0
- netbox_dns/locale/fr/LC_MESSAGES/django.mo +0 -0
- netbox_dns/management/commands/cleanup_database.py +175 -156
- netbox_dns/management/commands/cleanup_rrset_ttl.py +64 -0
- netbox_dns/management/commands/rebuild_dnssync.py +23 -0
- netbox_dns/management/commands/setup_dnssync.py +140 -0
- netbox_dns/migrations/0001_squashed_netbox_dns_0_15.py +0 -27
- netbox_dns/migrations/0001_squashed_netbox_dns_0_22.py +557 -0
- netbox_dns/migrations/{0013_add_nameserver_zone_record_description.py → 0002_contact_description_registrar_description.py} +4 -9
- netbox_dns/migrations/0003_default_view.py +15 -0
- netbox_dns/migrations/0004_create_and_assign_default_view.py +26 -0
- netbox_dns/migrations/0005_alter_zone_view_not_null.py +18 -0
- netbox_dns/migrations/0006_templating.py +172 -0
- netbox_dns/migrations/0007_alter_ordering_options.py +25 -0
- netbox_dns/migrations/0008_view_prefixes.py +18 -0
- netbox_dns/migrations/0009_rename_contact_registrationcontact.py +36 -0
- netbox_dns/migrations/0010_view_ip_address_filter.py +18 -0
- netbox_dns/migrations/0011_rename_related_fields.py +63 -0
- netbox_dns/migrations/0012_natural_ordering.py +88 -0
- netbox_dns/migrations/0013_zonetemplate_soa_mname_zonetemplate_soa_rname.py +30 -0
- netbox_dns/migrations/0014_alter_unique_constraints_lowercase.py +42 -0
- netbox_dns/migrations/0015_dnssec.py +168 -0
- netbox_dns/migrations/{0015_add_record_status.py → 0016_dnssec_policy_status.py} +5 -4
- netbox_dns/migrations/0017_dnssec_policy_zone_zone_template.py +41 -0
- netbox_dns/migrations/0018_zone_domain_status_zone_expiration_date.py +23 -0
- netbox_dns/migrations/0019_dnssecpolicy_parental_agents.py +25 -0
- netbox_dns/migrations/0020_netbox_3_4.py +1 -1
- netbox_dns/migrations/0020_remove_dnssecpolicy_parental_agents_and_more.py +29 -0
- netbox_dns/migrations/0021_alter_record_ptr_record.py +25 -0
- netbox_dns/migrations/0021_record_ip_address.py +1 -1
- netbox_dns/migrations/0022_alter_record_ipam_ip_address.py +26 -0
- netbox_dns/migrations/0023_disable_ptr_false.py +27 -0
- netbox_dns/migrations/0024_zonetemplate_parental_agents.py +25 -0
- netbox_dns/migrations/0025_remove_zone_inline_signing_and_more.py +22 -0
- netbox_dns/migrations/0026_alter_dnssecpolicy_nsec3_opt_out.py +18 -0
- netbox_dns/migrations/0026_domain_registration.py +1 -1
- netbox_dns/migrations/0027_zone_comments.py +18 -0
- netbox_dns/migrations/0028_alter_zone_default_ttl_alter_zone_soa_minimum_and_more.py +54 -0
- netbox_dns/migrations/0028_rfc2317_fields.py +44 -0
- netbox_dns/migrations/0029_alter_registrationcontact_street.py +18 -0
- netbox_dns/migrations/0029_record_fqdn.py +30 -0
- netbox_dns/mixins/__init__.py +1 -0
- netbox_dns/mixins/object_modification.py +57 -0
- netbox_dns/models/__init__.py +5 -1
- netbox_dns/models/dnssec_key_template.py +114 -0
- netbox_dns/models/dnssec_policy.py +203 -0
- netbox_dns/models/nameserver.py +61 -30
- netbox_dns/models/record.py +781 -234
- netbox_dns/models/record_template.py +198 -0
- netbox_dns/models/registrar.py +34 -15
- netbox_dns/models/{contact.py → registration_contact.py} +72 -43
- netbox_dns/models/view.py +129 -9
- netbox_dns/models/zone.py +806 -242
- netbox_dns/models/zone_template.py +209 -0
- netbox_dns/navigation.py +176 -76
- netbox_dns/signals/__init__.py +0 -0
- netbox_dns/signals/dnssec.py +32 -0
- netbox_dns/signals/ipam_dnssync.py +216 -0
- netbox_dns/tables/__init__.py +5 -1
- netbox_dns/tables/dnssec_key_template.py +49 -0
- netbox_dns/tables/dnssec_policy.py +140 -0
- netbox_dns/tables/ipam_dnssync.py +12 -0
- netbox_dns/tables/nameserver.py +14 -17
- netbox_dns/tables/record.py +117 -59
- netbox_dns/tables/record_template.py +91 -0
- netbox_dns/tables/registrar.py +20 -10
- netbox_dns/tables/{contact.py → registration_contact.py} +22 -11
- netbox_dns/tables/view.py +47 -3
- netbox_dns/tables/zone.py +62 -31
- netbox_dns/tables/zone_template.py +78 -0
- netbox_dns/template_content.py +124 -38
- netbox_dns/templates/netbox_dns/dnsseckeytemplate.html +70 -0
- netbox_dns/templates/netbox_dns/dnssecpolicy.html +163 -0
- netbox_dns/templates/netbox_dns/nameserver.html +31 -28
- netbox_dns/templates/netbox_dns/record/managed.html +2 -1
- netbox_dns/templates/netbox_dns/record/related.html +17 -6
- netbox_dns/templates/netbox_dns/record.html +140 -93
- netbox_dns/templates/netbox_dns/recordtemplate.html +96 -0
- netbox_dns/templates/netbox_dns/registrar.html +41 -34
- netbox_dns/templates/netbox_dns/registrationcontact.html +76 -0
- netbox_dns/templates/netbox_dns/view/button.html +10 -0
- netbox_dns/templates/netbox_dns/view/prefix.html +44 -0
- netbox_dns/templates/netbox_dns/view/related.html +33 -0
- netbox_dns/templates/netbox_dns/view.html +62 -18
- netbox_dns/templates/netbox_dns/zone/base.html +6 -3
- netbox_dns/templates/netbox_dns/zone/child.html +6 -5
- netbox_dns/templates/netbox_dns/zone/child_zone.html +18 -0
- netbox_dns/templates/netbox_dns/zone/delegation_record.html +18 -0
- netbox_dns/templates/netbox_dns/zone/managed_record.html +1 -1
- netbox_dns/templates/netbox_dns/zone/record.html +6 -5
- netbox_dns/templates/netbox_dns/zone/registration.html +43 -24
- netbox_dns/templates/netbox_dns/zone/rfc2317_child_zone.html +18 -0
- netbox_dns/templates/netbox_dns/zone.html +178 -119
- netbox_dns/templates/netbox_dns/zonetemplate/child.html +46 -0
- netbox_dns/templates/netbox_dns/zonetemplate.html +124 -0
- netbox_dns/templatetags/netbox_dns.py +10 -0
- netbox_dns/urls.py +50 -210
- netbox_dns/utilities/__init__.py +3 -0
- netbox_dns/{utilities.py → utilities/conversions.py} +55 -7
- netbox_dns/utilities/dns.py +11 -0
- netbox_dns/utilities/ipam_dnssync.py +370 -0
- netbox_dns/validators/__init__.py +4 -0
- netbox_dns/validators/dns_name.py +116 -0
- netbox_dns/validators/dns_value.py +147 -0
- netbox_dns/validators/dnssec.py +148 -0
- netbox_dns/validators/rfc2317.py +28 -0
- netbox_dns/views/__init__.py +5 -1
- netbox_dns/views/dnssec_key_template.py +78 -0
- netbox_dns/views/dnssec_policy.py +146 -0
- netbox_dns/views/nameserver.py +34 -15
- netbox_dns/views/record.py +156 -15
- netbox_dns/views/record_template.py +93 -0
- netbox_dns/views/registrar.py +32 -13
- netbox_dns/views/registration_contact.py +101 -0
- netbox_dns/views/view.py +58 -14
- netbox_dns/views/zone.py +130 -33
- netbox_dns/views/zone_template.py +82 -0
- netbox_plugin_dns-1.4.7.dist-info/METADATA +132 -0
- netbox_plugin_dns-1.4.7.dist-info/RECORD +201 -0
- {netbox_plugin_dns-0.21.4.dist-info → netbox_plugin_dns-1.4.7.dist-info}/WHEEL +2 -1
- {netbox_plugin_dns-0.21.4.dist-info → netbox_plugin_dns-1.4.7.dist-info/licenses}/LICENSE +2 -1
- netbox_plugin_dns-1.4.7.dist-info/top_level.txt +1 -0
- netbox_dns/filters/__init__.py +0 -6
- netbox_dns/filters/nameserver.py +0 -18
- netbox_dns/filters/record.py +0 -53
- netbox_dns/filters/view.py +0 -18
- netbox_dns/filters/zone.py +0 -112
- netbox_dns/forms/contact.py +0 -211
- netbox_dns/graphql/contact.py +0 -19
- netbox_dns/graphql/nameserver.py +0 -19
- netbox_dns/graphql/record.py +0 -19
- netbox_dns/graphql/registrar.py +0 -19
- netbox_dns/graphql/view.py +0 -19
- netbox_dns/graphql/zone.py +0 -19
- netbox_dns/management/commands/setup_coupling.py +0 -75
- netbox_dns/management/commands/update_soa.py +0 -22
- netbox_dns/middleware.py +0 -226
- netbox_dns/migrations/0001_initial.py +0 -115
- netbox_dns/migrations/0002_zone_default_ttl.py +0 -18
- netbox_dns/migrations/0003_soa_managed_records.py +0 -112
- netbox_dns/migrations/0004_create_ptr_for_a_aaaa_records.py +0 -80
- netbox_dns/migrations/0005_update_ns_records.py +0 -41
- netbox_dns/migrations/0006_zone_soa_serial_auto.py +0 -29
- netbox_dns/migrations/0007_alter_zone_soa_serial_auto.py +0 -17
- netbox_dns/migrations/0008_zone_status_names.py +0 -21
- netbox_dns/migrations/0009_netbox32.py +0 -71
- netbox_dns/migrations/0010_update_soa_records.py +0 -58
- netbox_dns/migrations/0011_add_view_model.py +0 -70
- netbox_dns/migrations/0012_adjust_zone_and_record.py +0 -17
- netbox_dns/migrations/0014_add_view_description.py +0 -16
- netbox_dns/migrations/0016_cleanup_ptr_records.py +0 -38
- netbox_dns/migrations/0017_alter_record_ttl.py +0 -17
- netbox_dns/migrations/0018_zone_arpa_network.py +0 -51
- netbox_dns/migrations/0019_update_ns_ttl.py +0 -19
- netbox_dns/templates/netbox_dns/contact.html +0 -71
- netbox_dns/templates/netbox_dns/related_dns_objects.html +0 -21
- netbox_dns/templatetags/view_helpers.py +0 -15
- netbox_dns/validators.py +0 -57
- netbox_dns/views/contact.py +0 -83
- netbox_plugin_dns-0.21.4.dist-info/METADATA +0 -101
- netbox_plugin_dns-0.21.4.dist-info/RECORD +0 -110
netbox_dns/views/record.py
CHANGED
|
@@ -1,41 +1,136 @@
|
|
|
1
1
|
from dns import name as dns_name
|
|
2
2
|
|
|
3
|
+
from django.utils.translation import gettext_lazy as _
|
|
4
|
+
|
|
3
5
|
from netbox.views import generic
|
|
6
|
+
from utilities.views import register_model_view
|
|
4
7
|
|
|
5
|
-
from netbox_dns.
|
|
8
|
+
from netbox_dns.filtersets import RecordFilterSet
|
|
6
9
|
from netbox_dns.forms import (
|
|
7
10
|
RecordImportForm,
|
|
8
11
|
RecordFilterForm,
|
|
9
12
|
RecordForm,
|
|
10
13
|
RecordBulkEditForm,
|
|
11
14
|
)
|
|
12
|
-
from netbox_dns.models import Record
|
|
13
|
-
from netbox_dns.
|
|
14
|
-
from netbox_dns.
|
|
15
|
+
from netbox_dns.models import Record, Zone
|
|
16
|
+
from netbox_dns.choices import RecordTypeChoices
|
|
17
|
+
from netbox_dns.tables import RecordTable, ManagedRecordTable, RelatedRecordTable
|
|
18
|
+
from netbox_dns.utilities import (
|
|
19
|
+
value_to_unicode,
|
|
20
|
+
get_parent_zone_names,
|
|
21
|
+
regex_from_list,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
__all__ = (
|
|
26
|
+
"RecordView",
|
|
27
|
+
"RecordListView",
|
|
28
|
+
"RecordEditView",
|
|
29
|
+
"RecordDeleteView",
|
|
30
|
+
"RecordBulkImportView",
|
|
31
|
+
"RecordBulkEditView",
|
|
32
|
+
"RecordBulkDeleteView",
|
|
33
|
+
"ManagedRecordListView",
|
|
34
|
+
)
|
|
15
35
|
|
|
16
36
|
|
|
37
|
+
class CNAMEWarning(Exception):
|
|
38
|
+
pass
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@register_model_view(Record, "list", path="", detail=False)
|
|
17
42
|
class RecordListView(generic.ObjectListView):
|
|
18
43
|
queryset = Record.objects.filter(managed=False).prefetch_related(
|
|
19
44
|
"zone", "ptr_record"
|
|
20
45
|
)
|
|
21
|
-
filterset =
|
|
46
|
+
filterset = RecordFilterSet
|
|
22
47
|
filterset_form = RecordFilterForm
|
|
23
48
|
table = RecordTable
|
|
24
49
|
|
|
25
50
|
|
|
51
|
+
@register_model_view(Record, "list_managed", path="managed", detail=False)
|
|
26
52
|
class ManagedRecordListView(generic.ObjectListView):
|
|
27
53
|
queryset = Record.objects.filter(managed=True).prefetch_related(
|
|
28
|
-
"
|
|
54
|
+
"ipam_ip_address", "address_records"
|
|
29
55
|
)
|
|
30
|
-
filterset =
|
|
56
|
+
filterset = RecordFilterSet
|
|
31
57
|
filterset_form = RecordFilterForm
|
|
32
58
|
table = ManagedRecordTable
|
|
33
|
-
actions =
|
|
59
|
+
actions = {"export": {"view"}}
|
|
34
60
|
template_name = "netbox_dns/record/managed.html"
|
|
35
61
|
|
|
36
62
|
|
|
63
|
+
@register_model_view(Record)
|
|
37
64
|
class RecordView(generic.ObjectView):
|
|
38
|
-
queryset = Record.objects.
|
|
65
|
+
queryset = Record.objects.prefetch_related("zone", "ptr_record")
|
|
66
|
+
|
|
67
|
+
def get_value_records(self, instance):
|
|
68
|
+
value_fqdn = dns_name.from_text(instance.value_fqdn)
|
|
69
|
+
|
|
70
|
+
cname_targets = Record.objects.filter(
|
|
71
|
+
zone__view=instance.zone.view,
|
|
72
|
+
fqdn=value_fqdn,
|
|
73
|
+
active=True,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
if cname_targets:
|
|
77
|
+
return RelatedRecordTable(
|
|
78
|
+
data=cname_targets,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
if instance.zone.view.zones.filter(
|
|
82
|
+
name__iregex=regex_from_list(
|
|
83
|
+
get_parent_zone_names(instance.value_fqdn, min_labels=1)
|
|
84
|
+
),
|
|
85
|
+
active=True,
|
|
86
|
+
).exists():
|
|
87
|
+
raise (
|
|
88
|
+
CNAMEWarning(
|
|
89
|
+
_(
|
|
90
|
+
"There is no matching target record for CNAME value {value}"
|
|
91
|
+
).format(value=instance.value_fqdn)
|
|
92
|
+
)
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
return None
|
|
96
|
+
|
|
97
|
+
def get_cname_records(self, instance):
|
|
98
|
+
cname_records = set(
|
|
99
|
+
Record.objects.filter(
|
|
100
|
+
zone__view=instance.zone.view,
|
|
101
|
+
value=instance.fqdn,
|
|
102
|
+
type=RecordTypeChoices.CNAME,
|
|
103
|
+
active=True,
|
|
104
|
+
)
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
parent_zones = instance.zone.view.zones.filter(
|
|
108
|
+
name__iregex=regex_from_list(
|
|
109
|
+
get_parent_zone_names(instance.fqdn, include_self=True)
|
|
110
|
+
),
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
for parent_zone in parent_zones:
|
|
114
|
+
parent_cname_records = Record.objects.filter(
|
|
115
|
+
zone__view=instance.zone.view,
|
|
116
|
+
type=RecordTypeChoices.CNAME,
|
|
117
|
+
zone=parent_zone,
|
|
118
|
+
active=True,
|
|
119
|
+
)
|
|
120
|
+
cname_records = cname_records.union(
|
|
121
|
+
{
|
|
122
|
+
record
|
|
123
|
+
for record in parent_cname_records
|
|
124
|
+
if record.value_fqdn == instance.fqdn
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
if cname_records:
|
|
129
|
+
return RelatedRecordTable(
|
|
130
|
+
data=cname_records,
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
return None
|
|
39
134
|
|
|
40
135
|
def get_extra_context(self, request, instance):
|
|
41
136
|
context = {}
|
|
@@ -48,40 +143,86 @@ class RecordView(generic.ObjectView):
|
|
|
48
143
|
if instance.value != unicode_value:
|
|
49
144
|
context["unicode_value"] = unicode_value
|
|
50
145
|
|
|
146
|
+
if instance.type == RecordTypeChoices.CNAME:
|
|
147
|
+
try:
|
|
148
|
+
cname_target_table = self.get_value_records(instance)
|
|
149
|
+
if cname_target_table is not None:
|
|
150
|
+
cname_target_table.configure(request)
|
|
151
|
+
context["cname_target_table"] = cname_target_table
|
|
152
|
+
except CNAMEWarning as exc:
|
|
153
|
+
context["cname_warning"] = str(exc)
|
|
154
|
+
else:
|
|
155
|
+
cname_table = self.get_cname_records(instance)
|
|
156
|
+
if cname_table is not None:
|
|
157
|
+
cname_table.configure(request)
|
|
158
|
+
context["cname_table"] = cname_table
|
|
159
|
+
|
|
160
|
+
if instance.ipam_ip_address is not None:
|
|
161
|
+
context["ipam_ip_address"] = instance.ipam_ip_address
|
|
162
|
+
elif instance.address_records is not None:
|
|
163
|
+
address_record = instance.address_records.filter(
|
|
164
|
+
ipam_ip_address__isnull=False
|
|
165
|
+
).first()
|
|
166
|
+
if address_record is not None:
|
|
167
|
+
context["ipam_ip_address"] = address_record.ipam_ip_address
|
|
168
|
+
|
|
169
|
+
if not instance.managed:
|
|
170
|
+
name = dns_name.from_text(instance.name, origin=None)
|
|
171
|
+
|
|
172
|
+
if not instance.is_delegation_record:
|
|
173
|
+
fqdn = dns_name.from_text(instance.fqdn)
|
|
174
|
+
|
|
175
|
+
if Zone.objects.filter(
|
|
176
|
+
active=True,
|
|
177
|
+
view=instance.zone.view,
|
|
178
|
+
name__iregex=regex_from_list(
|
|
179
|
+
get_parent_zone_names(
|
|
180
|
+
instance.fqdn,
|
|
181
|
+
min_labels=len(fqdn) - len(name),
|
|
182
|
+
include_self=True,
|
|
183
|
+
)
|
|
184
|
+
),
|
|
185
|
+
).exists():
|
|
186
|
+
context["mask_warning"] = _(
|
|
187
|
+
"Record is masked by a child zone and may not be visible in DNS"
|
|
188
|
+
)
|
|
189
|
+
|
|
51
190
|
return context
|
|
52
191
|
|
|
53
192
|
|
|
193
|
+
@register_model_view(Record, "add", detail=False)
|
|
194
|
+
@register_model_view(Record, "edit")
|
|
54
195
|
class RecordEditView(generic.ObjectEditView):
|
|
55
|
-
"""View for editing a Record instance."""
|
|
56
|
-
|
|
57
196
|
queryset = Record.objects.filter(managed=False).prefetch_related(
|
|
58
197
|
"zone", "ptr_record"
|
|
59
198
|
)
|
|
60
199
|
form = RecordForm
|
|
61
|
-
default_return_url = "plugins:netbox_dns:record_list"
|
|
62
200
|
|
|
63
201
|
|
|
202
|
+
@register_model_view(Record, "delete")
|
|
64
203
|
class RecordDeleteView(generic.ObjectDeleteView):
|
|
65
204
|
queryset = Record.objects.filter(managed=False)
|
|
66
|
-
default_return_url = "plugins:netbox_dns:record_list"
|
|
67
205
|
|
|
68
206
|
|
|
207
|
+
@register_model_view(Record, "bulk_import", detail=False)
|
|
69
208
|
class RecordBulkImportView(generic.BulkImportView):
|
|
70
209
|
queryset = Record.objects.filter(managed=False).prefetch_related(
|
|
71
210
|
"zone", "ptr_record"
|
|
72
211
|
)
|
|
73
212
|
model_form = RecordImportForm
|
|
74
213
|
table = RecordTable
|
|
75
|
-
default_return_url = "plugins:netbox_dns:record_list"
|
|
76
214
|
|
|
77
215
|
|
|
216
|
+
@register_model_view(Record, "bulk_edit", path="edit", detail=False)
|
|
78
217
|
class RecordBulkEditView(generic.BulkEditView):
|
|
79
218
|
queryset = Record.objects.filter(managed=False).prefetch_related("zone")
|
|
80
|
-
filterset =
|
|
219
|
+
filterset = RecordFilterSet
|
|
81
220
|
table = RecordTable
|
|
82
221
|
form = RecordBulkEditForm
|
|
83
222
|
|
|
84
223
|
|
|
224
|
+
@register_model_view(Record, "bulk_delete", path="delete", detail=False)
|
|
85
225
|
class RecordBulkDeleteView(generic.BulkDeleteView):
|
|
86
226
|
queryset = Record.objects.filter(managed=False)
|
|
227
|
+
filterset = RecordFilterSet
|
|
87
228
|
table = RecordTable
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
from dns import name as dns_name
|
|
2
|
+
|
|
3
|
+
from netbox.views import generic
|
|
4
|
+
from utilities.views import register_model_view
|
|
5
|
+
|
|
6
|
+
from netbox_dns.filtersets import RecordTemplateFilterSet
|
|
7
|
+
from netbox_dns.forms import (
|
|
8
|
+
RecordTemplateImportForm,
|
|
9
|
+
RecordTemplateFilterForm,
|
|
10
|
+
RecordTemplateForm,
|
|
11
|
+
RecordTemplateBulkEditForm,
|
|
12
|
+
)
|
|
13
|
+
from netbox_dns.models import RecordTemplate
|
|
14
|
+
from netbox_dns.tables import RecordTemplateTable, ZoneTemplateDisplayTable
|
|
15
|
+
from netbox_dns.utilities import value_to_unicode
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
__all__ = (
|
|
19
|
+
"RecordTemplateView",
|
|
20
|
+
"RecordTemplateListView",
|
|
21
|
+
"RecordTemplateEditView",
|
|
22
|
+
"RecordTemplateDeleteView",
|
|
23
|
+
"RecordTemplateBulkImportView",
|
|
24
|
+
"RecordTemplateBulkEditView",
|
|
25
|
+
"RecordTemplateBulkDeleteView",
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@register_model_view(RecordTemplate, "list", path="", detail=False)
|
|
30
|
+
class RecordTemplateListView(generic.ObjectListView):
|
|
31
|
+
queryset = RecordTemplate.objects.all()
|
|
32
|
+
filterset = RecordTemplateFilterSet
|
|
33
|
+
filterset_form = RecordTemplateFilterForm
|
|
34
|
+
table = RecordTemplateTable
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@register_model_view(RecordTemplate)
|
|
38
|
+
class RecordTemplateView(generic.ObjectView):
|
|
39
|
+
queryset = RecordTemplate.objects.all()
|
|
40
|
+
|
|
41
|
+
def get_extra_context(self, request, instance):
|
|
42
|
+
context = {}
|
|
43
|
+
|
|
44
|
+
name = dns_name.from_text(instance.record_name, origin=None)
|
|
45
|
+
if name.to_text() != name.to_unicode():
|
|
46
|
+
context["unicode_name"] = name.to_unicode()
|
|
47
|
+
|
|
48
|
+
unicode_value = value_to_unicode(instance.value)
|
|
49
|
+
if instance.value != unicode_value:
|
|
50
|
+
context["unicode_value"] = unicode_value
|
|
51
|
+
|
|
52
|
+
if instance.zone_templates.exists():
|
|
53
|
+
zone_template_table = ZoneTemplateDisplayTable(
|
|
54
|
+
data=instance.zone_templates.all()
|
|
55
|
+
)
|
|
56
|
+
zone_template_table.configure(request)
|
|
57
|
+
context["zone_template_table"] = zone_template_table
|
|
58
|
+
|
|
59
|
+
return context
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@register_model_view(RecordTemplate, "add", detail=False)
|
|
63
|
+
@register_model_view(RecordTemplate, "edit")
|
|
64
|
+
class RecordTemplateEditView(generic.ObjectEditView):
|
|
65
|
+
queryset = RecordTemplate.objects.all()
|
|
66
|
+
form = RecordTemplateForm
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@register_model_view(RecordTemplate, "delete")
|
|
70
|
+
class RecordTemplateDeleteView(generic.ObjectDeleteView):
|
|
71
|
+
queryset = RecordTemplate.objects.all()
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@register_model_view(RecordTemplate, "bulk_import", detail=False)
|
|
75
|
+
class RecordTemplateBulkImportView(generic.BulkImportView):
|
|
76
|
+
queryset = RecordTemplate.objects.all()
|
|
77
|
+
model_form = RecordTemplateImportForm
|
|
78
|
+
table = RecordTemplateTable
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
@register_model_view(RecordTemplate, "bulk_edit", path="edit", detail=False)
|
|
82
|
+
class RecordTemplateBulkEditView(generic.BulkEditView):
|
|
83
|
+
queryset = RecordTemplate.objects.all()
|
|
84
|
+
filterset = RecordTemplateFilterSet
|
|
85
|
+
table = RecordTemplateTable
|
|
86
|
+
form = RecordTemplateBulkEditForm
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@register_model_view(RecordTemplate, "bulk_delete", path="delete", detail=False)
|
|
90
|
+
class RecordTemplateBulkDeleteView(generic.BulkDeleteView):
|
|
91
|
+
queryset = RecordTemplate.objects.all()
|
|
92
|
+
filterset = RecordTemplateFilterSet
|
|
93
|
+
table = RecordTemplateTable
|
netbox_dns/views/registrar.py
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
from django.utils.translation import gettext as _
|
|
2
|
+
|
|
1
3
|
from netbox.views import generic
|
|
2
4
|
|
|
3
5
|
from utilities.views import ViewTab, register_model_view
|
|
4
6
|
|
|
5
7
|
from netbox_dns.models import Registrar, Zone
|
|
6
|
-
from netbox_dns.
|
|
8
|
+
from netbox_dns.filtersets import RegistrarFilterSet, ZoneFilterSet
|
|
7
9
|
from netbox_dns.forms import (
|
|
8
10
|
RegistrarForm,
|
|
9
11
|
RegistrarFilterForm,
|
|
@@ -13,62 +15,79 @@ from netbox_dns.forms import (
|
|
|
13
15
|
from netbox_dns.tables import RegistrarTable, ZoneTable
|
|
14
16
|
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
__all__ = (
|
|
19
|
+
"RegistrarView",
|
|
20
|
+
"RegistrarListView",
|
|
21
|
+
"RegistrarEditView",
|
|
22
|
+
"RegistrarDeleteView",
|
|
23
|
+
"RegistrarBulkImportView",
|
|
24
|
+
"RegistrarBulkEditView",
|
|
25
|
+
"RegistrarBulkDeleteView",
|
|
26
|
+
)
|
|
18
27
|
|
|
19
28
|
|
|
29
|
+
@register_model_view(Registrar, "list", path="", detail=False)
|
|
20
30
|
class RegistrarListView(generic.ObjectListView):
|
|
21
31
|
queryset = Registrar.objects.all()
|
|
22
32
|
table = RegistrarTable
|
|
23
|
-
filterset =
|
|
33
|
+
filterset = RegistrarFilterSet
|
|
24
34
|
filterset_form = RegistrarFilterForm
|
|
25
35
|
|
|
26
36
|
|
|
37
|
+
@register_model_view(Registrar)
|
|
38
|
+
class RegistrarView(generic.ObjectView):
|
|
39
|
+
queryset = Registrar.objects.all()
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@register_model_view(Registrar, "add", detail=False)
|
|
43
|
+
@register_model_view(Registrar, "edit")
|
|
27
44
|
class RegistrarEditView(generic.ObjectEditView):
|
|
28
45
|
queryset = Registrar.objects.all()
|
|
29
46
|
form = RegistrarForm
|
|
30
|
-
default_return_url = "plugins:netbox_dns:registrar_list"
|
|
31
47
|
|
|
32
48
|
|
|
49
|
+
@register_model_view(Registrar, "delete")
|
|
33
50
|
class RegistrarDeleteView(generic.ObjectDeleteView):
|
|
34
51
|
queryset = Registrar.objects.all()
|
|
35
|
-
default_return_url = "plugins:netbox_dns:registrar_list"
|
|
36
52
|
|
|
37
53
|
|
|
54
|
+
@register_model_view(Registrar, "bulk_import", detail=False)
|
|
38
55
|
class RegistrarBulkImportView(generic.BulkImportView):
|
|
39
56
|
queryset = Registrar.objects.all()
|
|
40
57
|
model_form = RegistrarImportForm
|
|
41
58
|
table = RegistrarTable
|
|
42
|
-
default_return_url = "plugins:netbox_dns:registrar_list"
|
|
43
59
|
|
|
44
60
|
|
|
61
|
+
@register_model_view(Registrar, "bulk_edit", path="edit", detail=False)
|
|
45
62
|
class RegistrarBulkEditView(generic.BulkEditView):
|
|
46
63
|
queryset = Registrar.objects.all()
|
|
47
|
-
filterset =
|
|
64
|
+
filterset = RegistrarFilterSet
|
|
48
65
|
table = RegistrarTable
|
|
49
66
|
form = RegistrarBulkEditForm
|
|
50
67
|
|
|
51
68
|
|
|
69
|
+
@register_model_view(Registrar, "bulk_delete", path="delete", detail=False)
|
|
52
70
|
class RegistrarBulkDeleteView(generic.BulkDeleteView):
|
|
53
71
|
queryset = Registrar.objects.all()
|
|
72
|
+
filterset = RegistrarFilterSet
|
|
54
73
|
table = RegistrarTable
|
|
55
74
|
|
|
56
75
|
|
|
57
76
|
@register_model_view(Registrar, "zones")
|
|
58
77
|
class RegistrarZoneListView(generic.ObjectChildrenView):
|
|
59
|
-
queryset = Registrar.objects.
|
|
78
|
+
queryset = Registrar.objects.prefetch_related("zones")
|
|
60
79
|
child_model = Zone
|
|
61
80
|
table = ZoneTable
|
|
62
|
-
filterset =
|
|
81
|
+
filterset = ZoneFilterSet
|
|
63
82
|
template_name = "netbox_dns/zone/child.html"
|
|
64
83
|
hide_if_empty = True
|
|
65
84
|
|
|
66
85
|
tab = ViewTab(
|
|
67
|
-
label="Zones",
|
|
86
|
+
label=_("Zones"),
|
|
68
87
|
permission="netbox_dns.view_zone",
|
|
69
|
-
badge=lambda obj: obj.
|
|
88
|
+
badge=lambda obj: obj.zones.count(),
|
|
70
89
|
hide_if_empty=True,
|
|
71
90
|
)
|
|
72
91
|
|
|
73
92
|
def get_children(self, request, parent):
|
|
74
|
-
return parent.
|
|
93
|
+
return parent.zones
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
from django.db.models import Q
|
|
2
|
+
from django.utils.translation import gettext_lazy as _
|
|
3
|
+
|
|
4
|
+
from netbox.views import generic
|
|
5
|
+
|
|
6
|
+
from utilities.views import ViewTab, register_model_view
|
|
7
|
+
|
|
8
|
+
from netbox_dns.models import RegistrationContact, Zone
|
|
9
|
+
from netbox_dns.filtersets import RegistrationContactFilterSet, ZoneFilterSet
|
|
10
|
+
from netbox_dns.forms import (
|
|
11
|
+
RegistrationContactForm,
|
|
12
|
+
RegistrationContactFilterForm,
|
|
13
|
+
RegistrationContactImportForm,
|
|
14
|
+
RegistrationContactBulkEditForm,
|
|
15
|
+
)
|
|
16
|
+
from netbox_dns.tables import RegistrationContactTable, ZoneTable
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
__all__ = (
|
|
20
|
+
"RegistrationContactView",
|
|
21
|
+
"RegistrationContactEditView",
|
|
22
|
+
"RegistrationContactListView",
|
|
23
|
+
"RegistrationContactDeleteView",
|
|
24
|
+
"RegistrationContactBulkImportView",
|
|
25
|
+
"RegistrationContactBulkEditView",
|
|
26
|
+
"RegistrationContactBulkDeleteView",
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@register_model_view(RegistrationContact, "list", path="", detail=False)
|
|
31
|
+
class RegistrationContactListView(generic.ObjectListView):
|
|
32
|
+
queryset = RegistrationContact.objects.all()
|
|
33
|
+
table = RegistrationContactTable
|
|
34
|
+
filterset = RegistrationContactFilterSet
|
|
35
|
+
filterset_form = RegistrationContactFilterForm
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@register_model_view(RegistrationContact)
|
|
39
|
+
class RegistrationContactView(generic.ObjectView):
|
|
40
|
+
queryset = RegistrationContact.objects.all()
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@register_model_view(RegistrationContact, "add", detail=False)
|
|
44
|
+
@register_model_view(RegistrationContact, "edit")
|
|
45
|
+
class RegistrationContactEditView(generic.ObjectEditView):
|
|
46
|
+
queryset = RegistrationContact.objects.all()
|
|
47
|
+
form = RegistrationContactForm
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@register_model_view(RegistrationContact, "delete")
|
|
51
|
+
class RegistrationContactDeleteView(generic.ObjectDeleteView):
|
|
52
|
+
queryset = RegistrationContact.objects.all()
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@register_model_view(RegistrationContact, "bulk_import", detail=False)
|
|
56
|
+
class RegistrationContactBulkImportView(generic.BulkImportView):
|
|
57
|
+
queryset = RegistrationContact.objects.all()
|
|
58
|
+
model_form = RegistrationContactImportForm
|
|
59
|
+
table = RegistrationContactTable
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@register_model_view(RegistrationContact, "bulk_edit", path="edit", detail=False)
|
|
63
|
+
class RegistrationContactBulkEditView(generic.BulkEditView):
|
|
64
|
+
queryset = RegistrationContact.objects.all()
|
|
65
|
+
filterset = RegistrationContactFilterSet
|
|
66
|
+
table = RegistrationContactTable
|
|
67
|
+
form = RegistrationContactBulkEditForm
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@register_model_view(RegistrationContact, "bulk_delete", path="delete", detail=False)
|
|
71
|
+
class RegistrationContactBulkDeleteView(generic.BulkDeleteView):
|
|
72
|
+
queryset = RegistrationContact.objects.all()
|
|
73
|
+
filterset = RegistrationContactFilterSet
|
|
74
|
+
table = RegistrationContactTable
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@register_model_view(RegistrationContact, "zones")
|
|
78
|
+
class RegistrationContactZoneListView(generic.ObjectChildrenView):
|
|
79
|
+
queryset = RegistrationContact.objects.prefetch_related(
|
|
80
|
+
"registrant_zones", "admin_c_zones", "tech_c_zones", "billing_c_zones"
|
|
81
|
+
)
|
|
82
|
+
child_model = Zone
|
|
83
|
+
table = ZoneTable
|
|
84
|
+
filterset = ZoneFilterSet
|
|
85
|
+
template_name = "netbox_dns/zone/child.html"
|
|
86
|
+
hide_if_empty = True
|
|
87
|
+
|
|
88
|
+
tab = ViewTab(
|
|
89
|
+
label=_("Zones"),
|
|
90
|
+
permission="netbox_dns.view_zone",
|
|
91
|
+
badge=lambda obj: len(obj.zones),
|
|
92
|
+
hide_if_empty=True,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
def get_children(self, request, parent):
|
|
96
|
+
return Zone.objects.filter(
|
|
97
|
+
Q(registrant=parent)
|
|
98
|
+
| Q(admin_c=parent)
|
|
99
|
+
| Q(tech_c=parent)
|
|
100
|
+
| Q(billing_c=parent)
|
|
101
|
+
)
|
netbox_dns/views/view.py
CHANGED
|
@@ -1,69 +1,113 @@
|
|
|
1
1
|
from utilities.views import ViewTab, register_model_view
|
|
2
|
+
from django.utils.translation import gettext_lazy as _
|
|
2
3
|
|
|
3
4
|
from netbox.views import generic
|
|
5
|
+
from ipam.models import Prefix
|
|
4
6
|
|
|
5
7
|
from netbox_dns.models import View, Zone
|
|
6
|
-
from netbox_dns.
|
|
7
|
-
from netbox_dns.forms import
|
|
8
|
+
from netbox_dns.filtersets import ViewFilterSet, ZoneFilterSet
|
|
9
|
+
from netbox_dns.forms import (
|
|
10
|
+
ViewForm,
|
|
11
|
+
ViewFilterForm,
|
|
12
|
+
ViewImportForm,
|
|
13
|
+
ViewBulkEditForm,
|
|
14
|
+
ViewPrefixEditForm,
|
|
15
|
+
)
|
|
8
16
|
from netbox_dns.tables import ViewTable, ZoneTable
|
|
17
|
+
from netbox_dns.utilities import get_views_by_prefix
|
|
9
18
|
|
|
10
19
|
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
__all__ = (
|
|
21
|
+
"ViewView",
|
|
22
|
+
"ViewListView",
|
|
23
|
+
"ViewEditView",
|
|
24
|
+
"ViewDeleteView",
|
|
25
|
+
"ViewBulkImportView",
|
|
26
|
+
"ViewBulkEditView",
|
|
27
|
+
"ViewBulkDeleteView",
|
|
28
|
+
"ViewPrefixEditView",
|
|
29
|
+
)
|
|
13
30
|
|
|
14
31
|
|
|
32
|
+
@register_model_view(View, "list", path="", detail=False)
|
|
15
33
|
class ViewListView(generic.ObjectListView):
|
|
16
34
|
queryset = View.objects.all()
|
|
17
35
|
table = ViewTable
|
|
18
|
-
filterset =
|
|
36
|
+
filterset = ViewFilterSet
|
|
19
37
|
filterset_form = ViewFilterForm
|
|
20
38
|
|
|
21
39
|
|
|
40
|
+
@register_model_view(View)
|
|
41
|
+
class ViewView(generic.ObjectView):
|
|
42
|
+
queryset = View.objects.prefetch_related("zones")
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@register_model_view(View, "add", detail=False)
|
|
46
|
+
@register_model_view(View, "edit")
|
|
22
47
|
class ViewEditView(generic.ObjectEditView):
|
|
23
48
|
queryset = View.objects.all()
|
|
24
49
|
form = ViewForm
|
|
25
|
-
default_return_url = "plugins:netbox_dns:view_list"
|
|
26
50
|
|
|
27
51
|
|
|
52
|
+
@register_model_view(View, "delete")
|
|
28
53
|
class ViewDeleteView(generic.ObjectDeleteView):
|
|
29
54
|
queryset = View.objects.all()
|
|
30
|
-
default_return_url = "plugins:netbox_dns:view_list"
|
|
31
55
|
|
|
32
56
|
|
|
57
|
+
@register_model_view(View, "bulk_import", detail=False)
|
|
33
58
|
class ViewBulkImportView(generic.BulkImportView):
|
|
34
59
|
queryset = View.objects.all()
|
|
35
60
|
model_form = ViewImportForm
|
|
36
61
|
table = ViewTable
|
|
37
|
-
default_return_url = "plugins:netbox_dns:view_list"
|
|
38
62
|
|
|
39
63
|
|
|
64
|
+
@register_model_view(View, "bulk_edit", path="edit", detail=False)
|
|
40
65
|
class ViewBulkEditView(generic.BulkEditView):
|
|
41
66
|
queryset = View.objects.all()
|
|
42
|
-
filterset =
|
|
67
|
+
filterset = ViewFilterSet
|
|
43
68
|
table = ViewTable
|
|
44
69
|
form = ViewBulkEditForm
|
|
45
70
|
|
|
46
71
|
|
|
72
|
+
@register_model_view(View, "bulk_delete", path="delete", detail=False)
|
|
47
73
|
class ViewBulkDeleteView(generic.BulkDeleteView):
|
|
48
74
|
queryset = View.objects.all()
|
|
75
|
+
filterset = ViewFilterSet
|
|
49
76
|
table = ViewTable
|
|
50
77
|
|
|
51
78
|
|
|
79
|
+
@register_model_view(Prefix, "views", path="assign-views")
|
|
80
|
+
class ViewPrefixEditView(generic.ObjectEditView):
|
|
81
|
+
queryset = Prefix.objects.all()
|
|
82
|
+
form = ViewPrefixEditForm
|
|
83
|
+
template_name = "netbox_dns/view/prefix.html"
|
|
84
|
+
|
|
85
|
+
def get_extra_context(self, request, instance):
|
|
86
|
+
parents = instance.get_parents()
|
|
87
|
+
if parents:
|
|
88
|
+
return {
|
|
89
|
+
"inherited_views": get_views_by_prefix(parents.last()),
|
|
90
|
+
"inherited_from": parents.filter(netbox_dns_views__isnull=False).last(),
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return {}
|
|
94
|
+
|
|
95
|
+
|
|
52
96
|
@register_model_view(View, "zones")
|
|
53
97
|
class ViewZoneListView(generic.ObjectChildrenView):
|
|
54
|
-
queryset = View.objects.
|
|
98
|
+
queryset = View.objects.prefetch_related("zones")
|
|
55
99
|
child_model = Zone
|
|
56
100
|
table = ZoneTable
|
|
57
|
-
filterset =
|
|
101
|
+
filterset = ZoneFilterSet
|
|
58
102
|
template_name = "netbox_dns/zone/child.html"
|
|
59
103
|
hide_if_empty = True
|
|
60
104
|
|
|
61
105
|
tab = ViewTab(
|
|
62
|
-
label="Zones",
|
|
106
|
+
label=_("Zones"),
|
|
63
107
|
permission="netbox_dns.view_zone",
|
|
64
|
-
badge=lambda obj: obj.
|
|
108
|
+
badge=lambda obj: obj.zones.count(),
|
|
65
109
|
hide_if_empty=True,
|
|
66
110
|
)
|
|
67
111
|
|
|
68
112
|
def get_children(self, request, parent):
|
|
69
|
-
return parent.
|
|
113
|
+
return parent.zones
|