netbox-plugin-dns 1.1.0b6__py3-none-any.whl → 1.1.1__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.

Files changed (79) hide show
  1. netbox_dns/__init__.py +1 -1
  2. netbox_dns/api/nested_serializers.py +17 -16
  3. netbox_dns/api/serializers.py +1 -1
  4. netbox_dns/api/serializers_/record.py +1 -0
  5. netbox_dns/api/serializers_/{contact.py → registration_contact.py} +5 -5
  6. netbox_dns/api/serializers_/zone.py +5 -5
  7. netbox_dns/api/serializers_/zone_template.py +5 -5
  8. netbox_dns/api/urls.py +2 -2
  9. netbox_dns/api/views.py +7 -35
  10. netbox_dns/filtersets/__init__.py +1 -1
  11. netbox_dns/filtersets/nameserver.py +0 -0
  12. netbox_dns/filtersets/record.py +0 -0
  13. netbox_dns/filtersets/record_template.py +0 -0
  14. netbox_dns/filtersets/{contact.py → registration_contact.py} +4 -4
  15. netbox_dns/filtersets/zone.py +15 -15
  16. netbox_dns/filtersets/zone_template.py +15 -15
  17. netbox_dns/forms/__init__.py +1 -1
  18. netbox_dns/forms/nameserver.py +0 -0
  19. netbox_dns/forms/record.py +0 -0
  20. netbox_dns/forms/record_template.py +0 -0
  21. netbox_dns/forms/{contact.py → registration_contact.py} +16 -16
  22. netbox_dns/forms/zone.py +13 -13
  23. netbox_dns/forms/zone_template.py +13 -13
  24. netbox_dns/graphql/__init__.py +2 -2
  25. netbox_dns/graphql/filters.py +5 -5
  26. netbox_dns/graphql/schema.py +24 -44
  27. netbox_dns/graphql/types.py +38 -12
  28. netbox_dns/management/commands/rebuild_dnssync.py +18 -0
  29. netbox_dns/migrations/0007_alter_ordering_options.py +25 -0
  30. netbox_dns/migrations/{0007_view_prefixes.py → 0008_view_prefixes.py} +1 -1
  31. netbox_dns/migrations/0009_rename_contact_registrationcontact.py +36 -0
  32. netbox_dns/models/__init__.py +1 -1
  33. netbox_dns/models/nameserver.py +8 -3
  34. netbox_dns/models/record.py +42 -20
  35. netbox_dns/models/record_template.py +4 -1
  36. netbox_dns/models/registrar.py +7 -1
  37. netbox_dns/models/{contact.py → registration_contact.py} +15 -9
  38. netbox_dns/models/view.py +9 -2
  39. netbox_dns/models/zone.py +48 -30
  40. netbox_dns/models/zone_template.py +12 -9
  41. netbox_dns/navigation.py +7 -7
  42. netbox_dns/signals/ipam_dnssync.py +6 -2
  43. netbox_dns/tables/__init__.py +1 -1
  44. netbox_dns/tables/nameserver.py +1 -7
  45. netbox_dns/tables/record.py +10 -37
  46. netbox_dns/tables/record_template.py +0 -17
  47. netbox_dns/tables/registrar.py +0 -2
  48. netbox_dns/tables/{contact.py → registration_contact.py} +5 -6
  49. netbox_dns/tables/view.py +1 -8
  50. netbox_dns/tables/zone.py +0 -15
  51. netbox_dns/tables/zone_template.py +2 -16
  52. netbox_dns/templates/netbox_dns/{contact.html → registrationcontact.html} +1 -1
  53. netbox_dns/urls/__init__.py +2 -2
  54. netbox_dns/urls/nameserver.py +14 -38
  55. netbox_dns/urls/record.py +7 -19
  56. netbox_dns/urls/record_template.py +18 -27
  57. netbox_dns/urls/registrar.py +11 -35
  58. netbox_dns/urls/registration_contact.py +60 -0
  59. netbox_dns/urls/view.py +8 -22
  60. netbox_dns/urls/zone.py +8 -46
  61. netbox_dns/urls/zone_template.py +16 -26
  62. netbox_dns/utilities/ipam_dnssync.py +26 -24
  63. netbox_dns/validators/dns_name.py +9 -0
  64. netbox_dns/views/__init__.py +1 -1
  65. netbox_dns/views/nameserver.py +7 -3
  66. netbox_dns/views/record.py +12 -7
  67. netbox_dns/views/record_template.py +1 -1
  68. netbox_dns/views/registrar.py +0 -1
  69. netbox_dns/views/registration_contact.py +94 -0
  70. netbox_dns/views/view.py +6 -1
  71. netbox_dns/views/zone.py +7 -6
  72. netbox_dns/views/zone_template.py +2 -2
  73. {netbox_plugin_dns-1.1.0b6.dist-info → netbox_plugin_dns-1.1.1.dist-info}/METADATA +14 -14
  74. {netbox_plugin_dns-1.1.0b6.dist-info → netbox_plugin_dns-1.1.1.dist-info}/RECORD +78 -74
  75. {netbox_plugin_dns-1.1.0b6.dist-info → netbox_plugin_dns-1.1.1.dist-info}/WHEEL +2 -1
  76. netbox_plugin_dns-1.1.1.dist-info/top_level.txt +1 -0
  77. netbox_dns/urls/contact.py +0 -51
  78. netbox_dns/views/contact.py +0 -95
  79. {netbox_plugin_dns-1.1.0b6.dist-info → netbox_plugin_dns-1.1.1.dist-info}/LICENSE +0 -0
netbox_dns/forms/zone.py CHANGED
@@ -30,7 +30,7 @@ from netbox_dns.models import (
30
30
  Zone,
31
31
  NameServer,
32
32
  Registrar,
33
- Contact,
33
+ RegistrationContact,
34
34
  ZoneTemplate,
35
35
  )
36
36
  from netbox_dns.choices import ZoneStatusChoices
@@ -421,22 +421,22 @@ class ZoneFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
421
421
  label="Registry Domain ID",
422
422
  )
423
423
  registrant_id = DynamicModelMultipleChoiceField(
424
- queryset=Contact.objects.all(),
424
+ queryset=RegistrationContact.objects.all(),
425
425
  required=False,
426
426
  label="Registrant",
427
427
  )
428
428
  admin_c_id = DynamicModelMultipleChoiceField(
429
- queryset=Contact.objects.all(),
429
+ queryset=RegistrationContact.objects.all(),
430
430
  required=False,
431
431
  label="Admin-C",
432
432
  )
433
433
  tech_c_id = DynamicModelMultipleChoiceField(
434
- queryset=Contact.objects.all(),
434
+ queryset=RegistrationContact.objects.all(),
435
435
  required=False,
436
436
  label="Tech-C",
437
437
  )
438
438
  billing_c_id = DynamicModelMultipleChoiceField(
439
- queryset=Contact.objects.all(),
439
+ queryset=RegistrationContact.objects.all(),
440
440
  required=False,
441
441
  label="Billing-C",
442
442
  )
@@ -532,7 +532,7 @@ class ZoneImportForm(ZoneTemplateUpdateMixin, NetBoxModelImportForm):
532
532
  help_text="Domain ID assigned by the registry",
533
533
  )
534
534
  registrant = CSVModelChoiceField(
535
- queryset=Contact.objects.all(),
535
+ queryset=RegistrationContact.objects.all(),
536
536
  required=False,
537
537
  to_field_name="contact_id",
538
538
  help_text="Owner of the domain",
@@ -541,7 +541,7 @@ class ZoneImportForm(ZoneTemplateUpdateMixin, NetBoxModelImportForm):
541
541
  },
542
542
  )
543
543
  admin_c = CSVModelChoiceField(
544
- queryset=Contact.objects.all(),
544
+ queryset=RegistrationContact.objects.all(),
545
545
  required=False,
546
546
  to_field_name="contact_id",
547
547
  help_text="Administrative contact for the domain",
@@ -550,7 +550,7 @@ class ZoneImportForm(ZoneTemplateUpdateMixin, NetBoxModelImportForm):
550
550
  },
551
551
  )
552
552
  tech_c = CSVModelChoiceField(
553
- queryset=Contact.objects.all(),
553
+ queryset=RegistrationContact.objects.all(),
554
554
  required=False,
555
555
  to_field_name="contact_id",
556
556
  help_text="Technical contact for the domain",
@@ -559,7 +559,7 @@ class ZoneImportForm(ZoneTemplateUpdateMixin, NetBoxModelImportForm):
559
559
  },
560
560
  )
561
561
  billing_c = CSVModelChoiceField(
562
- queryset=Contact.objects.all(),
562
+ queryset=RegistrationContact.objects.all(),
563
563
  required=False,
564
564
  to_field_name="contact_id",
565
565
  help_text="Billing contact for the domain",
@@ -719,21 +719,21 @@ class ZoneBulkEditForm(NetBoxModelBulkEditForm):
719
719
  label="Registry Domain ID",
720
720
  )
721
721
  registrant = DynamicModelChoiceField(
722
- queryset=Contact.objects.all(),
722
+ queryset=RegistrationContact.objects.all(),
723
723
  required=False,
724
724
  )
725
725
  admin_c = DynamicModelChoiceField(
726
- queryset=Contact.objects.all(),
726
+ queryset=RegistrationContact.objects.all(),
727
727
  required=False,
728
728
  label="Administrative Contact",
729
729
  )
730
730
  tech_c = DynamicModelChoiceField(
731
- queryset=Contact.objects.all(),
731
+ queryset=RegistrationContact.objects.all(),
732
732
  required=False,
733
733
  label="Technical Contact",
734
734
  )
735
735
  billing_c = DynamicModelChoiceField(
736
- queryset=Contact.objects.all(),
736
+ queryset=RegistrationContact.objects.all(),
737
737
  required=False,
738
738
  label="Billing Contact",
739
739
  )
@@ -22,7 +22,7 @@ from netbox_dns.models import (
22
22
  RecordTemplate,
23
23
  NameServer,
24
24
  Registrar,
25
- Contact,
25
+ RegistrationContact,
26
26
  )
27
27
 
28
28
 
@@ -117,22 +117,22 @@ class ZoneTemplateFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
117
117
  label="Registrar",
118
118
  )
119
119
  registrant_id = DynamicModelMultipleChoiceField(
120
- queryset=Contact.objects.all(),
120
+ queryset=RegistrationContact.objects.all(),
121
121
  required=False,
122
122
  label="Registrant",
123
123
  )
124
124
  admin_c_id = DynamicModelMultipleChoiceField(
125
- queryset=Contact.objects.all(),
125
+ queryset=RegistrationContact.objects.all(),
126
126
  required=False,
127
127
  label="Admin-C",
128
128
  )
129
129
  tech_c_id = DynamicModelMultipleChoiceField(
130
- queryset=Contact.objects.all(),
130
+ queryset=RegistrationContact.objects.all(),
131
131
  required=False,
132
132
  label="Tech-C",
133
133
  )
134
134
  billing_c_id = DynamicModelMultipleChoiceField(
135
- queryset=Contact.objects.all(),
135
+ queryset=RegistrationContact.objects.all(),
136
136
  required=False,
137
137
  label="Billing-C",
138
138
  )
@@ -162,7 +162,7 @@ class ZoneTemplateImportForm(NetBoxModelImportForm):
162
162
  },
163
163
  )
164
164
  registrant = CSVModelChoiceField(
165
- queryset=Contact.objects.all(),
165
+ queryset=RegistrationContact.objects.all(),
166
166
  required=False,
167
167
  to_field_name="contact_id",
168
168
  help_text="Owner of the domain",
@@ -171,7 +171,7 @@ class ZoneTemplateImportForm(NetBoxModelImportForm):
171
171
  },
172
172
  )
173
173
  admin_c = CSVModelChoiceField(
174
- queryset=Contact.objects.all(),
174
+ queryset=RegistrationContact.objects.all(),
175
175
  required=False,
176
176
  to_field_name="contact_id",
177
177
  help_text="Administrative contact for the domain",
@@ -180,7 +180,7 @@ class ZoneTemplateImportForm(NetBoxModelImportForm):
180
180
  },
181
181
  )
182
182
  tech_c = CSVModelChoiceField(
183
- queryset=Contact.objects.all(),
183
+ queryset=RegistrationContact.objects.all(),
184
184
  required=False,
185
185
  to_field_name="contact_id",
186
186
  help_text="Technical contact for the domain",
@@ -189,7 +189,7 @@ class ZoneTemplateImportForm(NetBoxModelImportForm):
189
189
  },
190
190
  )
191
191
  billing_c = CSVModelChoiceField(
192
- queryset=Contact.objects.all(),
192
+ queryset=RegistrationContact.objects.all(),
193
193
  required=False,
194
194
  to_field_name="contact_id",
195
195
  help_text="Billing contact for the domain",
@@ -237,21 +237,21 @@ class ZoneTemplateBulkEditForm(NetBoxModelBulkEditForm):
237
237
  required=False,
238
238
  )
239
239
  registrant = DynamicModelChoiceField(
240
- queryset=Contact.objects.all(),
240
+ queryset=RegistrationContact.objects.all(),
241
241
  required=False,
242
242
  )
243
243
  admin_c = DynamicModelChoiceField(
244
- queryset=Contact.objects.all(),
244
+ queryset=RegistrationContact.objects.all(),
245
245
  required=False,
246
246
  label="Administrative Contact",
247
247
  )
248
248
  tech_c = DynamicModelChoiceField(
249
- queryset=Contact.objects.all(),
249
+ queryset=RegistrationContact.objects.all(),
250
250
  required=False,
251
251
  label="Technical Contact",
252
252
  )
253
253
  billing_c = DynamicModelChoiceField(
254
- queryset=Contact.objects.all(),
254
+ queryset=RegistrationContact.objects.all(),
255
255
  required=False,
256
256
  label="Billing Contact",
257
257
  )
@@ -1,7 +1,7 @@
1
1
  from .schema import (
2
2
  NetBoxDNSViewQuery,
3
3
  NetBoxDNSNameServerQuery,
4
- NetBoxDNSContactQuery,
4
+ NetBoxDNSRegistrationContactQuery,
5
5
  NetBoxDNSRegistrarQuery,
6
6
  NetBoxDNSZoneQuery,
7
7
  NetBoxDNSRecordQuery,
@@ -14,7 +14,7 @@ schema = [
14
14
  NetBoxDNSViewQuery,
15
15
  NetBoxDNSZoneQuery,
16
16
  NetBoxDNSRecordQuery,
17
- NetBoxDNSContactQuery,
17
+ NetBoxDNSRegistrationContactQuery,
18
18
  NetBoxDNSRegistrarQuery,
19
19
  NetBoxDNSZoneTemplateQuery,
20
20
  NetBoxDNSRecordTemplateQuery,
@@ -7,7 +7,7 @@ from netbox_dns.models import (
7
7
  View,
8
8
  Zone,
9
9
  Record,
10
- Contact,
10
+ RegistrationContact,
11
11
  Registrar,
12
12
  ZoneTemplate,
13
13
  RecordTemplate,
@@ -17,7 +17,7 @@ from netbox_dns.filtersets import (
17
17
  ViewFilterSet,
18
18
  ZoneFilterSet,
19
19
  RecordFilterSet,
20
- ContactFilterSet,
20
+ RegistrationContactFilterSet,
21
21
  RegistrarFilterSet,
22
22
  ZoneTemplateFilterSet,
23
23
  RecordTemplateFilterSet,
@@ -60,9 +60,9 @@ class NetBoxDNSRecordTemplateFilter(BaseFilterMixin):
60
60
  pass
61
61
 
62
62
 
63
- @strawberry_django.filter(Contact, lookups=True)
64
- @autotype_decorator(ContactFilterSet)
65
- class NetBoxDNSContactFilter(BaseFilterMixin):
63
+ @strawberry_django.filter(RegistrationContact, lookups=True)
64
+ @autotype_decorator(RegistrationContactFilterSet)
65
+ class NetBoxDNSRegistrationContactFilter(BaseFilterMixin):
66
66
  pass
67
67
 
68
68
 
@@ -8,7 +8,7 @@ from netbox_dns.models import (
8
8
  View,
9
9
  Zone,
10
10
  Record,
11
- Contact,
11
+ RegistrationContact,
12
12
  Registrar,
13
13
  ZoneTemplate,
14
14
  RecordTemplate,
@@ -18,86 +18,66 @@ from .types import (
18
18
  NetBoxDNSViewType,
19
19
  NetBoxDNSZoneType,
20
20
  NetBoxDNSRecordType,
21
- NetBoxDNSContactType,
21
+ NetBoxDNSRegistrationContactType,
22
22
  NetBoxDNSRegistrarType,
23
23
  NetBoxDNSZoneTemplateType,
24
24
  NetBoxDNSRecordTemplateType,
25
25
  )
26
26
 
27
27
 
28
- @strawberry.type
28
+ @strawberry.type(name="Query")
29
29
  class NetBoxDNSNameServerQuery:
30
- @strawberry.field
31
- def netbox_dns_nameserver(self, id: int) -> NetBoxDNSNameServerType:
32
- return NameServer.objects.get(pk=id)
33
-
30
+ netbox_dns_nameserver: NetBoxDNSNameServerType = strawberry_django.field()
34
31
  netbox_dns_nameserver_list: List[NetBoxDNSNameServerType] = (
35
32
  strawberry_django.field()
36
33
  )
37
34
 
38
35
 
39
- @strawberry.type
36
+ @strawberry.type(name="Query")
40
37
  class NetBoxDNSViewQuery:
41
- @strawberry.field
42
- def netbox_dns_view(self, id: int) -> NetBoxDNSViewType:
43
- return View.objects.get(pk=id)
44
-
38
+ netbox_dns_view: NetBoxDNSViewType = strawberry_django.field()
45
39
  netbox_dns_view_list: List[NetBoxDNSViewType] = strawberry_django.field()
46
40
 
47
41
 
48
- @strawberry.type
42
+ @strawberry.type(name="Query")
49
43
  class NetBoxDNSZoneQuery:
50
- @strawberry.field
51
- def netbox_dns_zone(self, id: int) -> NetBoxDNSZoneType:
52
- return Zone.objects.get(pk=id)
53
-
44
+ netbox_dns_zone: NetBoxDNSZoneType = strawberry_django.field()
54
45
  netbox_dns_zone_list: List[NetBoxDNSZoneType] = strawberry_django.field()
55
46
 
56
47
 
57
- @strawberry.type
48
+ @strawberry.type(name="Query")
58
49
  class NetBoxDNSRecordQuery:
59
- @strawberry.field
60
- def netbox_dns_record(self, id: int) -> NetBoxDNSRecordType:
61
- return Record.objects.get(pk=id)
62
-
50
+ netbox_dns_record: NetBoxDNSRecordType = strawberry_django.field()
63
51
  netbox_dns_record_list: List[NetBoxDNSRecordType] = strawberry_django.field()
64
52
 
65
53
 
66
- @strawberry.type
67
- class NetBoxDNSContactQuery:
68
- @strawberry.field
69
- def netbox_dns_contact(self, id: int) -> NetBoxDNSContactType:
70
- return Contact.objects.get(pk=id)
71
-
72
- netbox_dns_contact_list: List[NetBoxDNSContactType] = strawberry_django.field()
54
+ @strawberry.type(name="Query")
55
+ class NetBoxDNSRegistrationContactQuery:
56
+ netbox_dns_registration_contact: NetBoxDNSRegistrationContactType = (
57
+ strawberry_django.field()
58
+ )
59
+ netbox_dns_registration_contact_list: List[NetBoxDNSRegistrationContactType] = (
60
+ strawberry_django.field()
61
+ )
73
62
 
74
63
 
75
- @strawberry.type
64
+ @strawberry.type(name="Query")
76
65
  class NetBoxDNSRegistrarQuery:
77
- @strawberry.field
78
- def netbox_dns_registrar(self, id: int) -> NetBoxDNSRegistrarType:
79
- return Registrar.objects.get(pk=id)
80
-
66
+ netbox_dns_registrar: NetBoxDNSRegistrarType = strawberry_django.field()
81
67
  netbox_dns_registrar_list: List[NetBoxDNSRegistrarType] = strawberry_django.field()
82
68
 
83
69
 
84
- @strawberry.type
70
+ @strawberry.type(name="Query")
85
71
  class NetBoxDNSZoneTemplateQuery:
86
- @strawberry.field
87
- def netbox_dns_zone_template(self, id: int) -> NetBoxDNSZoneTemplateType:
88
- return ZoneTemplate.objects.get(pk=id)
89
-
72
+ netbox_dns_zone_template: NetBoxDNSZoneTemplateType = strawberry_django.field()
90
73
  netbox_dns_zone_template_list: List[NetBoxDNSZoneTemplateType] = (
91
74
  strawberry_django.field()
92
75
  )
93
76
 
94
77
 
95
- @strawberry.type
78
+ @strawberry.type(name="Query")
96
79
  class NetBoxDNSRecordTemplateQuery:
97
- @strawberry.field
98
- def netbox_dns_record_template(self, id: int) -> NetBoxDNSRecordTemplateType:
99
- return RecordTemplate.objects.get(pk=id)
100
-
80
+ netbox_dns_record_template: NetBoxDNSRecordTemplateType = strawberry_django.field()
101
81
  netbox_dns_record_template_list: List[NetBoxDNSRecordTemplateType] = (
102
82
  strawberry_django.field()
103
83
  )
@@ -13,7 +13,7 @@ from netbox_dns.models import (
13
13
  View,
14
14
  Zone,
15
15
  Record,
16
- Contact,
16
+ RegistrationContact,
17
17
  Registrar,
18
18
  ZoneTemplate,
19
19
  RecordTemplate,
@@ -23,7 +23,7 @@ from .filters import (
23
23
  NetBoxDNSViewFilter,
24
24
  NetBoxDNSZoneFilter,
25
25
  NetBoxDNSRecordFilter,
26
- NetBoxDNSContactFilter,
26
+ NetBoxDNSRegistrationContactFilter,
27
27
  NetBoxDNSRegistrarFilter,
28
28
  NetBoxDNSZoneTemplateFilter,
29
29
  NetBoxDNSRecordTemplateFilter,
@@ -77,19 +77,31 @@ class NetBoxDNSZoneType(NetBoxObjectType):
77
77
  )
78
78
  registry_domain_id: str | None
79
79
  registrant: (
80
- Annotated["NetBoxDNSContactType", strawberry.lazy("netbox_dns.graphql.types")]
80
+ Annotated[
81
+ "NetBoxDNSRegistrationContactType",
82
+ strawberry.lazy("netbox_dns.graphql.types"),
83
+ ]
81
84
  | None
82
85
  )
83
86
  admin_c: (
84
- Annotated["NetBoxDNSContactType", strawberry.lazy("netbox_dns.graphql.types")]
87
+ Annotated[
88
+ "NetBoxDNSRegistrationContactType",
89
+ strawberry.lazy("netbox_dns.graphql.types"),
90
+ ]
85
91
  | None
86
92
  )
87
93
  tech_c: (
88
- Annotated["NetBoxDNSContactType", strawberry.lazy("netbox_dns.graphql.types")]
94
+ Annotated[
95
+ "NetBoxDNSRegistrationContactType",
96
+ strawberry.lazy("netbox_dns.graphql.types"),
97
+ ]
89
98
  | None
90
99
  )
91
100
  billing_c: (
92
- Annotated["NetBoxDNSContactType", strawberry.lazy("netbox_dns.graphql.types")]
101
+ Annotated[
102
+ "NetBoxDNSRegistrationContactType",
103
+ strawberry.lazy("netbox_dns.graphql.types"),
104
+ ]
93
105
  | None
94
106
  )
95
107
  rfc2317_prefix: str | None
@@ -126,8 +138,10 @@ class NetBoxDNSRecordType(NetBoxObjectType):
126
138
  )
127
139
 
128
140
 
129
- @strawberry_django.type(Contact, fields="__all__", filters=NetBoxDNSContactFilter)
130
- class NetBoxDNSContactType(NetBoxObjectType):
141
+ @strawberry_django.type(
142
+ RegistrationContact, fields="__all__", filters=NetBoxDNSRegistrationContactFilter
143
+ )
144
+ class NetBoxDNSRegistrationContactType(NetBoxObjectType):
131
145
  name: str
132
146
  contact_id: str
133
147
  description: str
@@ -178,19 +192,31 @@ class NetBoxDNSZoneTemplateType(NetBoxObjectType):
178
192
  | None
179
193
  )
180
194
  registrant: (
181
- Annotated["NetBoxDNSContactType", strawberry.lazy("netbox_dns.graphql.types")]
195
+ Annotated[
196
+ "NetBoxDNSRegistrationContactType",
197
+ strawberry.lazy("netbox_dns.graphql.types"),
198
+ ]
182
199
  | None
183
200
  )
184
201
  admin_c: (
185
- Annotated["NetBoxDNSContactType", strawberry.lazy("netbox_dns.graphql.types")]
202
+ Annotated[
203
+ "NetBoxDNSRegistrationContactType",
204
+ strawberry.lazy("netbox_dns.graphql.types"),
205
+ ]
186
206
  | None
187
207
  )
188
208
  tech_c: (
189
- Annotated["NetBoxDNSContactType", strawberry.lazy("netbox_dns.graphql.types")]
209
+ Annotated[
210
+ "NetBoxDNSRegistrationContactType",
211
+ strawberry.lazy("netbox_dns.graphql.types"),
212
+ ]
190
213
  | None
191
214
  )
192
215
  billing_c: (
193
- Annotated["NetBoxDNSContactType", strawberry.lazy("netbox_dns.graphql.types")]
216
+ Annotated[
217
+ "NetBoxDNSRegistrationContactType",
218
+ strawberry.lazy("netbox_dns.graphql.types"),
219
+ ]
194
220
  | None
195
221
  )
196
222
 
@@ -0,0 +1,18 @@
1
+ from django.core.management.base import BaseCommand
2
+
3
+ from ipam.models import IPAddress
4
+
5
+ from netbox_dns.utilities import update_dns_records
6
+
7
+
8
+ class Command(BaseCommand):
9
+ help = "Rebuild DNSsync relationships between IP addresses and records"
10
+
11
+ def handle(self, *model_names, **options):
12
+ ip_addresses = IPAddress.objects.all()
13
+ for ip_address in ip_addresses:
14
+ if options.get("verbosity") >= 2:
15
+ self.stdout.write(
16
+ f"Updating DNS records for IP Address {ip_address}, VRF {ip_address.vrf}"
17
+ )
18
+ update_dns_records(ip_address)
@@ -0,0 +1,25 @@
1
+ # Generated by Django 5.0.7 on 2024-08-27 09:29
2
+
3
+ from django.db import migrations
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ("netbox_dns", "0006_templating"),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AlterModelOptions(
14
+ name="record",
15
+ options={"ordering": ("fqdn", "zone", "name", "type", "value", "status")},
16
+ ),
17
+ migrations.AlterModelOptions(
18
+ name="recordtemplate",
19
+ options={"ordering": ("name",)},
20
+ ),
21
+ migrations.AlterModelOptions(
22
+ name="zonetemplate",
23
+ options={"ordering": ("name",)},
24
+ ),
25
+ ]
@@ -4,7 +4,7 @@ from django.db import migrations, models
4
4
  class Migration(migrations.Migration):
5
5
  dependencies = [
6
6
  ("ipam", "0067_ipaddress_index_host"),
7
- ("netbox_dns", "0006_templating"),
7
+ ("netbox_dns", "0007_alter_ordering_options"),
8
8
  ]
9
9
 
10
10
  operations = [
@@ -0,0 +1,36 @@
1
+ from django.db import migrations, connection
2
+
3
+
4
+ def remove_object_changes(apps, schema_editor):
5
+ if "objectchange" in apps.all_models.get("core"):
6
+ with connection.cursor() as cursor:
7
+ cursor.execute(
8
+ "DELETE FROM core_objectchange WHERE changed_object_type_id in (SELECT id FROM django_content_type WHERE app_label='netbox_dns' AND model='contact')"
9
+ )
10
+
11
+
12
+ class Migration(migrations.Migration):
13
+
14
+ dependencies = [
15
+ ("netbox_dns", "0008_view_prefixes"),
16
+ ]
17
+
18
+ operations = [
19
+ migrations.RenameModel(
20
+ old_name="Contact",
21
+ new_name="RegistrationContact",
22
+ ),
23
+ migrations.RunSQL(
24
+ "ALTER TABLE netbox_dns_contact_id_seq RENAME TO netbox_dns_registrationcontact_id_seq"
25
+ ),
26
+ migrations.RunSQL(
27
+ "ALTER INDEX netbox_dns_contact_pkey RENAME TO netbox_dns_registrationcontact_pkey"
28
+ ),
29
+ migrations.RunSQL(
30
+ "ALTER INDEX netbox_dns_contact_contact_id_50e9d89d_like RENAME TO netbox_dns_registrationcontact_contact_id_6ff98464_like"
31
+ ),
32
+ migrations.RunSQL(
33
+ "ALTER INDEX netbox_dns_contact_contact_id_key RENAME TO netbox_dns_contact_registrationcontact_id_key"
34
+ ),
35
+ migrations.RunPython(remove_object_changes),
36
+ ]
@@ -2,7 +2,7 @@ from .zone import *
2
2
  from .nameserver import *
3
3
  from .record import *
4
4
  from .view import *
5
- from .contact import *
5
+ from .registration_contact import *
6
6
  from .registrar import *
7
7
  from .zone_template import *
8
8
  from .record_template import *
@@ -7,6 +7,7 @@ from django.urls import reverse
7
7
 
8
8
  from netbox.models import NetBoxModel
9
9
  from netbox.search import SearchIndex, register_search
10
+ from netbox.models.features import ContactsMixin
10
11
 
11
12
  from netbox_dns.utilities import (
12
13
  name_to_unicode,
@@ -26,7 +27,7 @@ __all__ = (
26
27
  )
27
28
 
28
29
 
29
- class NameServer(ObjectModificationMixin, NetBoxModel):
30
+ class NameServer(ObjectModificationMixin, ContactsMixin, NetBoxModel):
30
31
  name = models.CharField(
31
32
  unique=True,
32
33
  max_length=255,
@@ -43,13 +44,17 @@ class NameServer(ObjectModificationMixin, NetBoxModel):
43
44
  null=True,
44
45
  )
45
46
 
46
- clone_fields = ["name", "description"]
47
+ clone_fields = (
48
+ "name",
49
+ "description",
50
+ )
47
51
 
48
52
  class Meta:
49
- ordering = ("name",)
50
53
  verbose_name = "Nameserver"
51
54
  verbose_name_plural = "Nameservers"
52
55
 
56
+ ordering = ("name",)
57
+
53
58
  def __str__(self):
54
59
  try:
55
60
  return dns_name.from_text(self.name, origin=None).to_unicode()