netbox-plugin-dns 1.0.3__py3-none-any.whl → 1.0.5__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.
Potentially problematic release.
This version of netbox-plugin-dns might be problematic. Click here for more details.
- netbox_dns/__init__.py +1 -1
- netbox_dns/api/nested_serializers.py +46 -1
- netbox_dns/api/serializers.py +2 -0
- netbox_dns/api/serializers_/contact.py +3 -0
- netbox_dns/api/serializers_/nameserver.py +4 -1
- netbox_dns/api/serializers_/record.py +5 -4
- netbox_dns/api/serializers_/record_template.py +57 -0
- netbox_dns/api/serializers_/registrar.py +3 -0
- netbox_dns/api/serializers_/view.py +3 -0
- netbox_dns/api/serializers_/zone.py +30 -6
- netbox_dns/api/serializers_/zone_template.py +129 -0
- netbox_dns/api/urls.py +4 -0
- netbox_dns/api/views.py +41 -1
- netbox_dns/choices/__init__.py +2 -0
- netbox_dns/choices/record.py +49 -0
- netbox_dns/choices/zone.py +20 -0
- netbox_dns/fields/address.py +6 -0
- netbox_dns/fields/network.py +3 -0
- netbox_dns/fields/rfc2317.py +3 -0
- netbox_dns/filtersets/__init__.py +3 -0
- netbox_dns/filtersets/contact.py +3 -0
- netbox_dns/filtersets/nameserver.py +3 -0
- netbox_dns/filtersets/record.py +5 -1
- netbox_dns/filtersets/record_template.py +54 -0
- netbox_dns/filtersets/registrar.py +3 -0
- netbox_dns/filtersets/view.py +3 -0
- netbox_dns/filtersets/zone.py +5 -8
- netbox_dns/filtersets/zone_template.py +116 -0
- netbox_dns/forms/__init__.py +2 -0
- netbox_dns/forms/contact.py +8 -0
- netbox_dns/forms/nameserver.py +8 -0
- netbox_dns/forms/record.py +25 -11
- netbox_dns/forms/record_template.py +220 -0
- netbox_dns/forms/registrar.py +8 -0
- netbox_dns/forms/view.py +10 -0
- netbox_dns/forms/zone.py +109 -36
- netbox_dns/forms/zone_template.py +298 -0
- netbox_dns/graphql/__init__.py +4 -0
- netbox_dns/graphql/filters.py +24 -1
- netbox_dns/graphql/schema.py +34 -1
- netbox_dns/graphql/types.py +73 -5
- netbox_dns/management/commands/cleanup_database.py +2 -6
- netbox_dns/management/commands/cleanup_rrset_ttl.py +2 -4
- netbox_dns/migrations/0001_squashed_netbox_dns_0_22.py +1 -2
- netbox_dns/migrations/0006_templating.py +172 -0
- netbox_dns/migrations/0021_record_ip_address.py +1 -1
- netbox_dns/mixins/object_modification.py +3 -0
- netbox_dns/models/__init__.py +7 -0
- netbox_dns/models/contact.py +6 -0
- netbox_dns/models/nameserver.py +8 -1
- netbox_dns/models/record.py +10 -122
- netbox_dns/models/record_template.py +180 -0
- netbox_dns/models/registrar.py +6 -0
- netbox_dns/models/view.py +7 -1
- netbox_dns/models/zone.py +57 -66
- netbox_dns/models/zone_template.py +149 -0
- netbox_dns/navigation.py +47 -0
- netbox_dns/tables/__init__.py +2 -0
- netbox_dns/tables/contact.py +3 -0
- netbox_dns/tables/nameserver.py +3 -2
- netbox_dns/tables/record.py +7 -3
- netbox_dns/tables/record_template.py +91 -0
- netbox_dns/tables/registrar.py +3 -0
- netbox_dns/tables/view.py +3 -0
- netbox_dns/tables/zone.py +3 -2
- netbox_dns/tables/zone_template.py +70 -0
- netbox_dns/template_content.py +2 -8
- netbox_dns/templates/netbox_dns/recordtemplate.html +84 -0
- netbox_dns/templates/netbox_dns/zonetemplate.html +86 -0
- netbox_dns/urls/__init__.py +4 -0
- netbox_dns/urls/record_template.py +65 -0
- netbox_dns/urls/zone_template.py +57 -0
- netbox_dns/utilities/ipam_coupling.py +2 -1
- netbox_dns/validators/__init__.py +1 -0
- netbox_dns/validators/dns_name.py +14 -9
- netbox_dns/validators/dns_value.py +83 -0
- netbox_dns/validators/rfc2317.py +7 -0
- netbox_dns/views/__init__.py +2 -0
- netbox_dns/views/contact.py +11 -0
- netbox_dns/views/nameserver.py +12 -0
- netbox_dns/views/record.py +14 -1
- netbox_dns/views/record_template.py +83 -0
- netbox_dns/views/registrar.py +12 -0
- netbox_dns/views/view.py +12 -0
- netbox_dns/views/zone.py +16 -0
- netbox_dns/views/zone_template.py +73 -0
- {netbox_plugin_dns-1.0.3.dist-info → netbox_plugin_dns-1.0.5.dist-info}/METADATA +2 -1
- netbox_plugin_dns-1.0.5.dist-info/RECORD +136 -0
- netbox_plugin_dns-1.0.3.dist-info/RECORD +0 -115
- {netbox_plugin_dns-1.0.3.dist-info → netbox_plugin_dns-1.0.5.dist-info}/LICENSE +0 -0
- {netbox_plugin_dns-1.0.3.dist-info → netbox_plugin_dns-1.0.5.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import django_filters
|
|
2
|
+
from django.db.models import Q
|
|
3
|
+
|
|
4
|
+
from netbox.filtersets import NetBoxModelFilterSet
|
|
5
|
+
from tenancy.filtersets import TenancyFilterSet
|
|
6
|
+
|
|
7
|
+
from netbox_dns.models import RecordTemplate, ZoneTemplate
|
|
8
|
+
from netbox_dns.choices import RecordTypeChoices, RecordStatusChoices
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
__ALL__ = ("RecordTemplateFilterSet",)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class RecordTemplateFilterSet(TenancyFilterSet, NetBoxModelFilterSet):
|
|
15
|
+
type = django_filters.MultipleChoiceFilter(
|
|
16
|
+
choices=RecordTypeChoices,
|
|
17
|
+
)
|
|
18
|
+
status = django_filters.MultipleChoiceFilter(
|
|
19
|
+
choices=RecordStatusChoices,
|
|
20
|
+
)
|
|
21
|
+
zone_template = django_filters.ModelMultipleChoiceFilter(
|
|
22
|
+
queryset=ZoneTemplate.objects.all(),
|
|
23
|
+
field_name="zone_templates__name",
|
|
24
|
+
to_field_name="name",
|
|
25
|
+
label="Zone Template",
|
|
26
|
+
)
|
|
27
|
+
zone_template_id = django_filters.ModelMultipleChoiceFilter(
|
|
28
|
+
queryset=ZoneTemplate.objects.all(),
|
|
29
|
+
field_name="zone_templates",
|
|
30
|
+
to_field_name="id",
|
|
31
|
+
label="Zone Template ID",
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
class Meta:
|
|
35
|
+
model = RecordTemplate
|
|
36
|
+
fields = (
|
|
37
|
+
"id",
|
|
38
|
+
"name",
|
|
39
|
+
"record_name",
|
|
40
|
+
"value",
|
|
41
|
+
"description",
|
|
42
|
+
"ttl",
|
|
43
|
+
"disable_ptr",
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
def search(self, queryset, name, value):
|
|
47
|
+
if not value.strip():
|
|
48
|
+
return queryset
|
|
49
|
+
qs_filter = (
|
|
50
|
+
Q(name__icontains=value)
|
|
51
|
+
| Q(record_name__icontains=value)
|
|
52
|
+
| Q(value__icontains=value)
|
|
53
|
+
)
|
|
54
|
+
return queryset.filter(qs_filter)
|
netbox_dns/filtersets/view.py
CHANGED
netbox_dns/filtersets/zone.py
CHANGED
|
@@ -7,14 +7,11 @@ from netbox.filtersets import NetBoxModelFilterSet
|
|
|
7
7
|
from tenancy.filtersets import TenancyFilterSet
|
|
8
8
|
from utilities.filters import MultiValueCharFilter
|
|
9
9
|
|
|
10
|
-
from netbox_dns.models import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Contact,
|
|
16
|
-
NameServer,
|
|
17
|
-
)
|
|
10
|
+
from netbox_dns.models import View, Zone, Registrar, Contact, NameServer
|
|
11
|
+
from netbox_dns.choices import ZoneStatusChoices
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
__ALL__ = ("ZoneFilterSet",)
|
|
18
15
|
|
|
19
16
|
|
|
20
17
|
class ZoneFilterSet(TenancyFilterSet, NetBoxModelFilterSet):
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import django_filters
|
|
2
|
+
|
|
3
|
+
from django.db.models import Q
|
|
4
|
+
|
|
5
|
+
from netbox.filtersets import NetBoxModelFilterSet
|
|
6
|
+
from tenancy.filtersets import TenancyFilterSet
|
|
7
|
+
|
|
8
|
+
from netbox_dns.models import (
|
|
9
|
+
ZoneTemplate,
|
|
10
|
+
RecordTemplate,
|
|
11
|
+
Registrar,
|
|
12
|
+
Contact,
|
|
13
|
+
NameServer,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
__ALL__ = ("ZoneTemplateFilterSet",)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class ZoneTemplateFilterSet(TenancyFilterSet, NetBoxModelFilterSet):
|
|
21
|
+
record_template_id = django_filters.ModelMultipleChoiceFilter(
|
|
22
|
+
queryset=RecordTemplate.objects.all(),
|
|
23
|
+
field_name="record_templates",
|
|
24
|
+
to_field_name="id",
|
|
25
|
+
label="Record Template ID",
|
|
26
|
+
)
|
|
27
|
+
record_template = django_filters.ModelMultipleChoiceFilter(
|
|
28
|
+
queryset=RecordTemplate.objects.all(),
|
|
29
|
+
field_name="record_templates__name",
|
|
30
|
+
to_field_name="name",
|
|
31
|
+
label="Record Template",
|
|
32
|
+
)
|
|
33
|
+
nameserver_id = django_filters.ModelMultipleChoiceFilter(
|
|
34
|
+
queryset=NameServer.objects.all(),
|
|
35
|
+
field_name="nameservers",
|
|
36
|
+
to_field_name="id",
|
|
37
|
+
label="Nameservers ID",
|
|
38
|
+
)
|
|
39
|
+
nameserver = django_filters.ModelMultipleChoiceFilter(
|
|
40
|
+
queryset=NameServer.objects.all(),
|
|
41
|
+
field_name="nameservers__name",
|
|
42
|
+
to_field_name="name",
|
|
43
|
+
label="Nameserver",
|
|
44
|
+
)
|
|
45
|
+
registrar_id = django_filters.ModelMultipleChoiceFilter(
|
|
46
|
+
queryset=Registrar.objects.all(),
|
|
47
|
+
label="Registrar ID",
|
|
48
|
+
)
|
|
49
|
+
registrar = django_filters.ModelMultipleChoiceFilter(
|
|
50
|
+
queryset=Registrar.objects.all(),
|
|
51
|
+
field_name="registrar__name",
|
|
52
|
+
to_field_name="name",
|
|
53
|
+
label="Registrar",
|
|
54
|
+
)
|
|
55
|
+
registrant_id = django_filters.ModelMultipleChoiceFilter(
|
|
56
|
+
queryset=Contact.objects.all(),
|
|
57
|
+
label="Registrant ID",
|
|
58
|
+
)
|
|
59
|
+
registrant = django_filters.ModelMultipleChoiceFilter(
|
|
60
|
+
queryset=Contact.objects.all(),
|
|
61
|
+
field_name="registrant__contact_id",
|
|
62
|
+
to_field_name="contact_id",
|
|
63
|
+
label="Registrant",
|
|
64
|
+
)
|
|
65
|
+
admin_c_id = django_filters.ModelMultipleChoiceFilter(
|
|
66
|
+
queryset=Contact.objects.all(),
|
|
67
|
+
label="Administrative Contact ID",
|
|
68
|
+
)
|
|
69
|
+
admin_c = django_filters.ModelMultipleChoiceFilter(
|
|
70
|
+
queryset=Contact.objects.all(),
|
|
71
|
+
field_name="admin_c__contact_id",
|
|
72
|
+
to_field_name="contact_id",
|
|
73
|
+
label="Administrative Contact",
|
|
74
|
+
)
|
|
75
|
+
tech_c_id = django_filters.ModelMultipleChoiceFilter(
|
|
76
|
+
queryset=Contact.objects.all(),
|
|
77
|
+
label="Technical Contact ID",
|
|
78
|
+
)
|
|
79
|
+
tech_c = django_filters.ModelMultipleChoiceFilter(
|
|
80
|
+
queryset=Contact.objects.all(),
|
|
81
|
+
field_name="tech_c__contact_id",
|
|
82
|
+
to_field_name="contact_id",
|
|
83
|
+
label="Technical Contact",
|
|
84
|
+
)
|
|
85
|
+
billing_c_id = django_filters.ModelMultipleChoiceFilter(
|
|
86
|
+
queryset=Contact.objects.all(),
|
|
87
|
+
label="Billing Contact ID",
|
|
88
|
+
)
|
|
89
|
+
billing_c = django_filters.ModelMultipleChoiceFilter(
|
|
90
|
+
queryset=Contact.objects.all(),
|
|
91
|
+
field_name="billing_c__contact_id",
|
|
92
|
+
to_field_name="contact_id",
|
|
93
|
+
label="Billing Contact",
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
class Meta:
|
|
97
|
+
model = ZoneTemplate
|
|
98
|
+
fields = (
|
|
99
|
+
"id",
|
|
100
|
+
"name",
|
|
101
|
+
"description",
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
def search(self, queryset, name, value):
|
|
105
|
+
if not value.strip():
|
|
106
|
+
return queryset
|
|
107
|
+
qs_filter = (
|
|
108
|
+
Q(name__icontains=value)
|
|
109
|
+
| Q(registrar__name__icontains=value)
|
|
110
|
+
| Q(registry_domain_id__icontains=value)
|
|
111
|
+
| Q(registrant__name__icontains=value)
|
|
112
|
+
| Q(admin_c__name__icontains=value)
|
|
113
|
+
| Q(tech_c__name__icontains=value)
|
|
114
|
+
| Q(billing_c__name__icontains=value)
|
|
115
|
+
)
|
|
116
|
+
return queryset.filter(qs_filter)
|
netbox_dns/forms/__init__.py
CHANGED
netbox_dns/forms/contact.py
CHANGED
|
@@ -12,6 +12,14 @@ from utilities.forms.rendering import FieldSet
|
|
|
12
12
|
from netbox_dns.models import Contact
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
__ALL__ = (
|
|
16
|
+
"ContactForm",
|
|
17
|
+
"ContactFilterForm",
|
|
18
|
+
"ContactImportForm",
|
|
19
|
+
"ContactBulkEditForm",
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
|
|
15
23
|
class ContactForm(NetBoxModelForm):
|
|
16
24
|
fieldsets = (
|
|
17
25
|
FieldSet(
|
netbox_dns/forms/nameserver.py
CHANGED
|
@@ -20,6 +20,14 @@ from netbox_dns.models import NameServer
|
|
|
20
20
|
from netbox_dns.utilities import name_to_unicode
|
|
21
21
|
|
|
22
22
|
|
|
23
|
+
__ALL__ = (
|
|
24
|
+
"NameServerForm",
|
|
25
|
+
"NameServerFilterForm",
|
|
26
|
+
"NameServerImportForm",
|
|
27
|
+
"NameServerBulkEditForm",
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
23
31
|
class NameServerForm(TenancyForm, NetBoxModelForm):
|
|
24
32
|
def __init__(self, *args, **kwargs):
|
|
25
33
|
super().__init__(*args, **kwargs)
|
netbox_dns/forms/record.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
from django import forms
|
|
2
|
-
from django.urls import reverse_lazy
|
|
3
2
|
|
|
4
3
|
from netbox.forms import (
|
|
5
4
|
NetBoxModelBulkEditForm,
|
|
@@ -14,16 +13,25 @@ from utilities.forms.fields import (
|
|
|
14
13
|
CSVModelChoiceField,
|
|
15
14
|
DynamicModelChoiceField,
|
|
16
15
|
)
|
|
17
|
-
from utilities.forms.widgets import BulkEditNullBooleanSelect
|
|
18
|
-
from utilities.forms import add_blank_choice
|
|
16
|
+
from utilities.forms.widgets import BulkEditNullBooleanSelect
|
|
17
|
+
from utilities.forms import BOOLEAN_WITH_BLANK_CHOICES, add_blank_choice
|
|
19
18
|
from utilities.forms.rendering import FieldSet
|
|
20
19
|
from tenancy.models import Tenant
|
|
21
20
|
from tenancy.forms import TenancyForm, TenancyFilterForm
|
|
22
21
|
|
|
23
|
-
from netbox_dns.models import View, Zone, Record
|
|
22
|
+
from netbox_dns.models import View, Zone, Record
|
|
23
|
+
from netbox_dns.choices import RecordTypeChoices, RecordStatusChoices
|
|
24
24
|
from netbox_dns.utilities import name_to_unicode
|
|
25
25
|
|
|
26
26
|
|
|
27
|
+
__ALL__ = (
|
|
28
|
+
"RecordForm",
|
|
29
|
+
"RecordFilterForm",
|
|
30
|
+
"RecordImportForm",
|
|
31
|
+
"RecordBulkEditForm",
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
27
35
|
class RecordForm(TenancyForm, NetBoxModelForm):
|
|
28
36
|
def __init__(self, *args, **kwargs):
|
|
29
37
|
super().__init__(*args, **kwargs)
|
|
@@ -52,7 +60,7 @@ class RecordForm(TenancyForm, NetBoxModelForm):
|
|
|
52
60
|
label="Zone",
|
|
53
61
|
)
|
|
54
62
|
|
|
55
|
-
disable_ptr = forms.
|
|
63
|
+
disable_ptr = forms.NullBooleanField(
|
|
56
64
|
label="Disable PTR",
|
|
57
65
|
required=False,
|
|
58
66
|
)
|
|
@@ -130,6 +138,7 @@ class RecordFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|
|
130
138
|
disable_ptr = forms.NullBooleanField(
|
|
131
139
|
required=False,
|
|
132
140
|
label="Disable PTR",
|
|
141
|
+
widget=forms.Select(choices=BOOLEAN_WITH_BLANK_CHOICES),
|
|
133
142
|
)
|
|
134
143
|
status = forms.MultipleChoiceField(
|
|
135
144
|
choices=RecordStatusChoices,
|
|
@@ -233,9 +242,6 @@ class RecordBulkEditForm(NetBoxModelBulkEditForm):
|
|
|
233
242
|
zone = DynamicModelChoiceField(
|
|
234
243
|
queryset=Zone.objects.all(),
|
|
235
244
|
required=False,
|
|
236
|
-
widget=APISelect(
|
|
237
|
-
attrs={"data-url": reverse_lazy("plugins-api:netbox_dns-api:zone-list")}
|
|
238
|
-
),
|
|
239
245
|
)
|
|
240
246
|
type = forms.ChoiceField(
|
|
241
247
|
choices=add_blank_choice(RecordTypeChoices),
|
|
@@ -254,10 +260,18 @@ class RecordBulkEditForm(NetBoxModelBulkEditForm):
|
|
|
254
260
|
label="TTL",
|
|
255
261
|
)
|
|
256
262
|
disable_ptr = forms.NullBooleanField(
|
|
257
|
-
required=False,
|
|
263
|
+
required=False,
|
|
264
|
+
label="Disable PTR",
|
|
265
|
+
widget=BulkEditNullBooleanSelect(),
|
|
266
|
+
)
|
|
267
|
+
description = forms.CharField(
|
|
268
|
+
max_length=200,
|
|
269
|
+
required=False,
|
|
270
|
+
)
|
|
271
|
+
tenant = DynamicModelChoiceField(
|
|
272
|
+
queryset=Tenant.objects.all(),
|
|
273
|
+
required=False,
|
|
258
274
|
)
|
|
259
|
-
description = forms.CharField(max_length=200, required=False)
|
|
260
|
-
tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(), required=False)
|
|
261
275
|
|
|
262
276
|
fieldsets = (
|
|
263
277
|
FieldSet(
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
from django import forms
|
|
2
|
+
|
|
3
|
+
from netbox.forms import (
|
|
4
|
+
NetBoxModelBulkEditForm,
|
|
5
|
+
NetBoxModelFilterSetForm,
|
|
6
|
+
NetBoxModelImportForm,
|
|
7
|
+
NetBoxModelForm,
|
|
8
|
+
)
|
|
9
|
+
from utilities.forms.fields import (
|
|
10
|
+
DynamicModelMultipleChoiceField,
|
|
11
|
+
TagFilterField,
|
|
12
|
+
CSVChoiceField,
|
|
13
|
+
CSVModelChoiceField,
|
|
14
|
+
DynamicModelChoiceField,
|
|
15
|
+
)
|
|
16
|
+
from utilities.forms.widgets import BulkEditNullBooleanSelect
|
|
17
|
+
from utilities.forms import add_blank_choice
|
|
18
|
+
from utilities.forms.rendering import FieldSet
|
|
19
|
+
from tenancy.models import Tenant
|
|
20
|
+
from tenancy.forms import TenancyForm, TenancyFilterForm
|
|
21
|
+
|
|
22
|
+
from netbox_dns.models import RecordTemplate, ZoneTemplate
|
|
23
|
+
from netbox_dns.choices import RecordTypeChoices, RecordStatusChoices
|
|
24
|
+
from netbox_dns.utilities import name_to_unicode
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
__ALL__ = (
|
|
28
|
+
"RecordTemplateForm",
|
|
29
|
+
"RecordTemplateFilterForm",
|
|
30
|
+
"RecordTemplateImportForm",
|
|
31
|
+
"RecordTemplateBulkEditForm",
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class RecordTemplateForm(TenancyForm, NetBoxModelForm):
|
|
36
|
+
def __init__(self, *args, **kwargs):
|
|
37
|
+
super().__init__(*args, **kwargs)
|
|
38
|
+
|
|
39
|
+
initial_record_name = self.initial.get("record_name")
|
|
40
|
+
if initial_record_name:
|
|
41
|
+
self.initial["record_name"] = name_to_unicode(initial_record_name)
|
|
42
|
+
|
|
43
|
+
disable_ptr = forms.BooleanField(
|
|
44
|
+
label="Disable PTR",
|
|
45
|
+
required=False,
|
|
46
|
+
)
|
|
47
|
+
ttl = forms.IntegerField(
|
|
48
|
+
required=False,
|
|
49
|
+
label="TTL",
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
fieldsets = (
|
|
53
|
+
FieldSet(
|
|
54
|
+
"name",
|
|
55
|
+
"record_name",
|
|
56
|
+
"type",
|
|
57
|
+
"value",
|
|
58
|
+
"status",
|
|
59
|
+
"ttl",
|
|
60
|
+
"disable_ptr",
|
|
61
|
+
"description",
|
|
62
|
+
name="Record Template",
|
|
63
|
+
),
|
|
64
|
+
FieldSet("tenant_group", "tenant", name="Tenancy"),
|
|
65
|
+
FieldSet("tags", name="Tags"),
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
class Meta:
|
|
69
|
+
model = RecordTemplate
|
|
70
|
+
|
|
71
|
+
fields = (
|
|
72
|
+
"name",
|
|
73
|
+
"record_name",
|
|
74
|
+
"type",
|
|
75
|
+
"value",
|
|
76
|
+
"status",
|
|
77
|
+
"ttl",
|
|
78
|
+
"disable_ptr",
|
|
79
|
+
"description",
|
|
80
|
+
"tags",
|
|
81
|
+
"tenant",
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class RecordTemplateFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|
86
|
+
model = RecordTemplate
|
|
87
|
+
fieldsets = (
|
|
88
|
+
FieldSet("q", "filter_id", "tag"),
|
|
89
|
+
FieldSet(
|
|
90
|
+
"name",
|
|
91
|
+
"record_name",
|
|
92
|
+
"type",
|
|
93
|
+
"value",
|
|
94
|
+
"status",
|
|
95
|
+
"disable_ptr",
|
|
96
|
+
"status",
|
|
97
|
+
"description",
|
|
98
|
+
name="Attributes",
|
|
99
|
+
),
|
|
100
|
+
FieldSet("zone_template_id", name="Zone Templates"),
|
|
101
|
+
FieldSet("tenant_group_id", "tenant_id", name="Tenancy"),
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
type = forms.MultipleChoiceField(
|
|
105
|
+
choices=RecordTypeChoices,
|
|
106
|
+
required=False,
|
|
107
|
+
)
|
|
108
|
+
name = forms.CharField(
|
|
109
|
+
required=False,
|
|
110
|
+
label="Template name",
|
|
111
|
+
)
|
|
112
|
+
record_name = forms.CharField(
|
|
113
|
+
required=False,
|
|
114
|
+
label="Name",
|
|
115
|
+
)
|
|
116
|
+
value = forms.CharField(
|
|
117
|
+
required=False,
|
|
118
|
+
)
|
|
119
|
+
status = forms.MultipleChoiceField(
|
|
120
|
+
choices=RecordStatusChoices,
|
|
121
|
+
required=False,
|
|
122
|
+
)
|
|
123
|
+
disable_ptr = forms.NullBooleanField(
|
|
124
|
+
required=False,
|
|
125
|
+
label="Disable PTR",
|
|
126
|
+
)
|
|
127
|
+
description = forms.CharField(
|
|
128
|
+
required=False,
|
|
129
|
+
)
|
|
130
|
+
zone_template_id = DynamicModelMultipleChoiceField(
|
|
131
|
+
queryset=ZoneTemplate.objects.all(),
|
|
132
|
+
required=False,
|
|
133
|
+
label="Zone templates",
|
|
134
|
+
)
|
|
135
|
+
tag = TagFilterField(RecordTemplate)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
class RecordTemplateImportForm(NetBoxModelImportForm):
|
|
139
|
+
type = CSVChoiceField(
|
|
140
|
+
choices=RecordTypeChoices,
|
|
141
|
+
required=True,
|
|
142
|
+
help_text="Record Type",
|
|
143
|
+
)
|
|
144
|
+
status = CSVChoiceField(
|
|
145
|
+
choices=RecordStatusChoices,
|
|
146
|
+
required=False,
|
|
147
|
+
help_text="Record status",
|
|
148
|
+
)
|
|
149
|
+
ttl = forms.IntegerField(
|
|
150
|
+
required=False,
|
|
151
|
+
help_text="TTL",
|
|
152
|
+
)
|
|
153
|
+
disable_ptr = forms.BooleanField(
|
|
154
|
+
required=False,
|
|
155
|
+
label="Disable PTR",
|
|
156
|
+
help_text="Disable generation of a PTR record",
|
|
157
|
+
)
|
|
158
|
+
tenant = CSVModelChoiceField(
|
|
159
|
+
queryset=Tenant.objects.all(),
|
|
160
|
+
to_field_name="name",
|
|
161
|
+
required=False,
|
|
162
|
+
help_text="Assigned tenant",
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
class Meta:
|
|
166
|
+
model = RecordTemplate
|
|
167
|
+
|
|
168
|
+
fields = (
|
|
169
|
+
"name",
|
|
170
|
+
"record_name",
|
|
171
|
+
"type",
|
|
172
|
+
"value",
|
|
173
|
+
"status",
|
|
174
|
+
"ttl",
|
|
175
|
+
"disable_ptr",
|
|
176
|
+
"description",
|
|
177
|
+
"tenant",
|
|
178
|
+
"tags",
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
class RecordTemplateBulkEditForm(NetBoxModelBulkEditForm):
|
|
183
|
+
model = RecordTemplate
|
|
184
|
+
|
|
185
|
+
type = forms.ChoiceField(
|
|
186
|
+
choices=add_blank_choice(RecordTypeChoices),
|
|
187
|
+
required=False,
|
|
188
|
+
)
|
|
189
|
+
value = forms.CharField(
|
|
190
|
+
required=False,
|
|
191
|
+
label="Value",
|
|
192
|
+
)
|
|
193
|
+
status = forms.ChoiceField(
|
|
194
|
+
choices=add_blank_choice(RecordStatusChoices),
|
|
195
|
+
required=False,
|
|
196
|
+
)
|
|
197
|
+
ttl = forms.IntegerField(
|
|
198
|
+
required=False,
|
|
199
|
+
label="TTL",
|
|
200
|
+
)
|
|
201
|
+
disable_ptr = forms.NullBooleanField(
|
|
202
|
+
required=False, widget=BulkEditNullBooleanSelect(), label="Disable PTR"
|
|
203
|
+
)
|
|
204
|
+
description = forms.CharField(max_length=200, required=False)
|
|
205
|
+
tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(), required=False)
|
|
206
|
+
|
|
207
|
+
fieldsets = (
|
|
208
|
+
FieldSet(
|
|
209
|
+
"record_name",
|
|
210
|
+
"type",
|
|
211
|
+
"value",
|
|
212
|
+
"status",
|
|
213
|
+
"ttl",
|
|
214
|
+
"disable_ptr",
|
|
215
|
+
"description",
|
|
216
|
+
name="Attributes",
|
|
217
|
+
),
|
|
218
|
+
FieldSet("tenant_group", "tenant", name="Tenancy"),
|
|
219
|
+
)
|
|
220
|
+
nullable_fields = ("description", "ttl", "tenant")
|
netbox_dns/forms/registrar.py
CHANGED
|
@@ -12,6 +12,14 @@ from utilities.forms.rendering import FieldSet
|
|
|
12
12
|
from netbox_dns.models import Registrar
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
__ALL__ = (
|
|
16
|
+
"RegistrarForm",
|
|
17
|
+
"RegistrarFilterForm",
|
|
18
|
+
"RegistrarImportForm",
|
|
19
|
+
"RegistrarBulkEditForm",
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
|
|
15
23
|
class RegistrarForm(NetBoxModelForm):
|
|
16
24
|
class Meta:
|
|
17
25
|
model = Registrar
|
netbox_dns/forms/view.py
CHANGED
|
@@ -11,6 +11,7 @@ from utilities.forms.fields import (
|
|
|
11
11
|
CSVModelChoiceField,
|
|
12
12
|
DynamicModelChoiceField,
|
|
13
13
|
)
|
|
14
|
+
from utilities.forms import BOOLEAN_WITH_BLANK_CHOICES
|
|
14
15
|
from utilities.forms.rendering import FieldSet
|
|
15
16
|
from tenancy.models import Tenant
|
|
16
17
|
from tenancy.forms import TenancyForm, TenancyFilterForm
|
|
@@ -18,6 +19,14 @@ from tenancy.forms import TenancyForm, TenancyFilterForm
|
|
|
18
19
|
from netbox_dns.models import View
|
|
19
20
|
|
|
20
21
|
|
|
22
|
+
__ALL__ = (
|
|
23
|
+
"ViewForm",
|
|
24
|
+
"ViewFilterForm",
|
|
25
|
+
"ViewImportForm",
|
|
26
|
+
"ViewBulkEditForm",
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
21
30
|
class ViewForm(TenancyForm, NetBoxModelForm):
|
|
22
31
|
fieldsets = (
|
|
23
32
|
FieldSet("name", "default_view", "description", "tags", name="View"),
|
|
@@ -42,6 +51,7 @@ class ViewFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|
|
42
51
|
)
|
|
43
52
|
default_view = forms.NullBooleanField(
|
|
44
53
|
required=False,
|
|
54
|
+
widget=forms.Select(choices=BOOLEAN_WITH_BLANK_CHOICES),
|
|
45
55
|
)
|
|
46
56
|
description = forms.CharField(
|
|
47
57
|
required=False,
|