netbox-plugin-dns 0.22.9__py3-none-any.whl → 1.0.0__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 (115) hide show
  1. netbox_dns/__init__.py +4 -15
  2. netbox_dns/api/nested_serializers.py +4 -60
  3. netbox_dns/api/serializers.py +8 -314
  4. netbox_dns/api/serializers_/__init__.py +0 -0
  5. netbox_dns/api/serializers_/contact.py +37 -0
  6. netbox_dns/api/serializers_/nameserver.py +39 -0
  7. netbox_dns/api/serializers_/record.py +90 -0
  8. netbox_dns/api/serializers_/registrar.py +31 -0
  9. netbox_dns/api/serializers_/view.py +34 -0
  10. netbox_dns/api/serializers_/zone.py +159 -0
  11. netbox_dns/api/views.py +13 -13
  12. netbox_dns/fields/network.py +21 -22
  13. netbox_dns/fields/rfc2317.py +3 -3
  14. netbox_dns/{filters → filtersets}/contact.py +2 -1
  15. netbox_dns/filtersets/nameserver.py +37 -0
  16. netbox_dns/{filters → filtersets}/record.py +51 -6
  17. netbox_dns/{filters → filtersets}/registrar.py +2 -1
  18. netbox_dns/{filters → filtersets}/view.py +2 -2
  19. netbox_dns/filtersets/zone.py +205 -0
  20. netbox_dns/forms/contact.py +61 -33
  21. netbox_dns/forms/nameserver.py +21 -8
  22. netbox_dns/forms/record.py +65 -38
  23. netbox_dns/forms/registrar.py +45 -15
  24. netbox_dns/forms/view.py +23 -9
  25. netbox_dns/forms/zone.py +182 -188
  26. netbox_dns/graphql/__init__.py +17 -27
  27. netbox_dns/graphql/filters.py +49 -0
  28. netbox_dns/graphql/schema.py +66 -7
  29. netbox_dns/graphql/types.py +143 -0
  30. netbox_dns/management/commands/cleanup_database.py +0 -4
  31. netbox_dns/management/commands/cleanup_rrset_ttl.py +2 -4
  32. netbox_dns/management/commands/setup_coupling.py +15 -15
  33. netbox_dns/management/commands/update_soa.py +1 -1
  34. netbox_dns/migrations/0001_squashed_netbox_dns_0_15.py +0 -27
  35. netbox_dns/migrations/0001_squashed_netbox_dns_0_22.py +558 -0
  36. netbox_dns/migrations/{0013_add_nameserver_zone_record_description.py → 0002_contact_description_registrar_description.py} +4 -9
  37. netbox_dns/migrations/0003_default_view.py +15 -0
  38. netbox_dns/migrations/0004_create_and_assign_default_view.py +26 -0
  39. netbox_dns/migrations/0005_alter_zone_view_not_null.py +18 -0
  40. netbox_dns/migrations/0020_netbox_3_4.py +1 -1
  41. netbox_dns/models/contact.py +6 -1
  42. netbox_dns/models/nameserver.py +2 -0
  43. netbox_dns/models/record.py +28 -33
  44. netbox_dns/models/registrar.py +5 -1
  45. netbox_dns/models/view.py +54 -1
  46. netbox_dns/models/zone.py +68 -54
  47. netbox_dns/navigation.py +1 -15
  48. netbox_dns/signals/ipam_coupling.py +3 -9
  49. netbox_dns/tables/contact.py +1 -0
  50. netbox_dns/tables/nameserver.py +0 -2
  51. netbox_dns/tables/registrar.py +1 -0
  52. netbox_dns/tables/view.py +9 -2
  53. netbox_dns/template_content.py +4 -8
  54. netbox_dns/templates/netbox_dns/contact.html +60 -56
  55. netbox_dns/templates/netbox_dns/nameserver.html +27 -27
  56. netbox_dns/templates/netbox_dns/record.html +92 -94
  57. netbox_dns/templates/netbox_dns/registrar.html +38 -36
  58. netbox_dns/templates/netbox_dns/view.html +25 -21
  59. netbox_dns/templates/netbox_dns/zone/base.html +5 -3
  60. netbox_dns/templates/netbox_dns/zone/child.html +3 -3
  61. netbox_dns/templates/netbox_dns/zone/managed_record.html +1 -1
  62. netbox_dns/templates/netbox_dns/zone/record.html +3 -3
  63. netbox_dns/templates/netbox_dns/zone/registration.html +26 -27
  64. netbox_dns/templates/netbox_dns/zone/rfc2317_child_zone.html +1 -1
  65. netbox_dns/templates/netbox_dns/zone.html +148 -149
  66. netbox_dns/urls/__init__.py +17 -0
  67. netbox_dns/urls/contact.py +51 -0
  68. netbox_dns/urls/nameserver.py +69 -0
  69. netbox_dns/urls/record.py +41 -0
  70. netbox_dns/urls/registrar.py +63 -0
  71. netbox_dns/urls/view.py +39 -0
  72. netbox_dns/urls/zone.py +57 -0
  73. netbox_dns/utilities/__init__.py +1 -6
  74. netbox_dns/utilities/ipam_coupling.py +2 -7
  75. netbox_dns/validators/dns_name.py +4 -9
  76. netbox_dns/validators/rfc2317.py +2 -2
  77. netbox_dns/views/contact.py +4 -4
  78. netbox_dns/views/nameserver.py +5 -5
  79. netbox_dns/views/record.py +15 -23
  80. netbox_dns/views/registrar.py +4 -4
  81. netbox_dns/views/view.py +4 -4
  82. netbox_dns/views/zone.py +7 -8
  83. {netbox_plugin_dns-0.22.9.dist-info → netbox_plugin_dns-1.0.0.dist-info}/METADATA +27 -13
  84. netbox_plugin_dns-1.0.0.dist-info/RECORD +112 -0
  85. netbox_dns/filters/nameserver.py +0 -18
  86. netbox_dns/filters/zone.py +0 -112
  87. netbox_dns/graphql/contact.py +0 -19
  88. netbox_dns/graphql/nameserver.py +0 -19
  89. netbox_dns/graphql/record.py +0 -19
  90. netbox_dns/graphql/registrar.py +0 -19
  91. netbox_dns/graphql/view.py +0 -19
  92. netbox_dns/graphql/zone.py +0 -19
  93. netbox_dns/migrations/0001_initial.py +0 -115
  94. netbox_dns/migrations/0002_zone_default_ttl.py +0 -18
  95. netbox_dns/migrations/0003_soa_managed_records.py +0 -112
  96. netbox_dns/migrations/0004_create_ptr_for_a_aaaa_records.py +0 -80
  97. netbox_dns/migrations/0005_update_ns_records.py +0 -41
  98. netbox_dns/migrations/0006_zone_soa_serial_auto.py +0 -29
  99. netbox_dns/migrations/0007_alter_zone_soa_serial_auto.py +0 -17
  100. netbox_dns/migrations/0008_zone_status_names.py +0 -21
  101. netbox_dns/migrations/0009_netbox32.py +0 -71
  102. netbox_dns/migrations/0010_update_soa_records.py +0 -58
  103. netbox_dns/migrations/0011_add_view_model.py +0 -70
  104. netbox_dns/migrations/0012_adjust_zone_and_record.py +0 -17
  105. netbox_dns/migrations/0014_add_view_description.py +0 -16
  106. netbox_dns/migrations/0015_add_record_status.py +0 -17
  107. netbox_dns/migrations/0016_cleanup_ptr_records.py +0 -38
  108. netbox_dns/migrations/0017_alter_record_ttl.py +0 -17
  109. netbox_dns/migrations/0018_zone_arpa_network.py +0 -51
  110. netbox_dns/migrations/0019_update_ns_ttl.py +0 -19
  111. netbox_dns/urls.py +0 -297
  112. netbox_plugin_dns-0.22.9.dist-info/RECORD +0 -117
  113. /netbox_dns/{filters → filtersets}/__init__.py +0 -0
  114. {netbox_plugin_dns-0.22.9.dist-info → netbox_plugin_dns-1.0.0.dist-info}/LICENSE +0 -0
  115. {netbox_plugin_dns-0.22.9.dist-info → netbox_plugin_dns-1.0.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,558 @@
1
+ # Generated by Django 5.0.1 on 2024-02-12 14:49
2
+
3
+ from dns import name as dns_name
4
+
5
+ import django.core.validators
6
+ import django.db.models.deletion
7
+ import netbox_dns.fields.address
8
+ import netbox_dns.fields.network
9
+ import netbox_dns.fields.rfc2317
10
+ import taggit.managers
11
+ import utilities.json
12
+ from django.db import migrations, models
13
+
14
+
15
+ from netbox_dns.models import RecordTypeChoices
16
+ from netbox_dns.utilities import arpa_to_prefix
17
+
18
+
19
+ def fqdn(record):
20
+ if record.name == "@":
21
+ return f"{record.zone.name}."
22
+
23
+ return f"{record.name}.{record.zone.name}."
24
+
25
+
26
+ def address_from_name(record):
27
+ prefix = arpa_to_prefix(fqdn(record))
28
+ if prefix is not None:
29
+ return prefix.ip
30
+
31
+ return None
32
+
33
+
34
+ def update_ip_addresses(apps, schema_editor):
35
+ Record = apps.get_model("netbox_dns", "Record")
36
+
37
+ for record in Record.objects.filter(type=RecordTypeChoices.PTR):
38
+ record.ip_address = address_from_name(record)
39
+ record.save()
40
+
41
+ for record in Record.objects.filter(
42
+ type__in=(RecordTypeChoices.A, RecordTypeChoices.AAAA)
43
+ ):
44
+ record.ip_address = record.value
45
+ record.save()
46
+
47
+
48
+ def update_record_fqdn(apps, schema_editor):
49
+ Record = apps.get_model("netbox_dns", "Record")
50
+
51
+ for record in Record.objects.filter(fqdn__isnull=True):
52
+ zone = dns_name.from_text(record.zone.name, origin=dns_name.root)
53
+ _fqdn = dns_name.from_text(record.name, origin=zone)
54
+
55
+ record.fqdn = _fqdn.to_text()
56
+
57
+ record.save()
58
+
59
+
60
+ class Migration(migrations.Migration):
61
+ replaces = [
62
+ ("netbox_dns", "0001_squashed_netbox_dns_0_15"),
63
+ ("netbox_dns", "0020_netbox_3_4"),
64
+ ("netbox_dns", "0021_record_ip_address"),
65
+ ("netbox_dns", "0022_search"),
66
+ ("netbox_dns", "0023_alter_record_value"),
67
+ ("netbox_dns", "0024_tenancy"),
68
+ ("netbox_dns", "0025_ipam_coupling_cf"),
69
+ ("netbox_dns", "0026_domain_registration"),
70
+ ("netbox_dns", "0027_alter_registrar_iana_id"),
71
+ ("netbox_dns", "0028_rfc2317_fields"),
72
+ ("netbox_dns", "0029_record_fqdn"),
73
+ ]
74
+
75
+ initial = True
76
+
77
+ dependencies = [
78
+ ("extras", "0073_journalentry_tags_custom_fields"),
79
+ ("ipam", "0066_iprange_mark_utilized"),
80
+ ("tenancy", "0010_tenant_relax_uniqueness"),
81
+ ]
82
+
83
+ operations = [
84
+ migrations.CreateModel(
85
+ name="NameServer",
86
+ fields=[
87
+ ("created", models.DateTimeField(auto_now_add=True, null=True)),
88
+ ("last_updated", models.DateTimeField(auto_now=True, null=True)),
89
+ (
90
+ "custom_field_data",
91
+ models.JSONField(
92
+ blank=True,
93
+ default=dict,
94
+ encoder=utilities.json.CustomFieldJSONEncoder,
95
+ ),
96
+ ),
97
+ (
98
+ "id",
99
+ models.BigAutoField(
100
+ auto_created=True, primary_key=True, serialize=False
101
+ ),
102
+ ),
103
+ ("name", models.CharField(max_length=255, unique=True)),
104
+ (
105
+ "tags",
106
+ taggit.managers.TaggableManager(
107
+ through="extras.TaggedItem", to="extras.Tag"
108
+ ),
109
+ ),
110
+ ("description", models.CharField(blank=True, max_length=200)),
111
+ ],
112
+ options={
113
+ "ordering": ("name",),
114
+ },
115
+ ),
116
+ migrations.CreateModel(
117
+ name="View",
118
+ fields=[
119
+ (
120
+ "id",
121
+ models.BigAutoField(
122
+ auto_created=True, primary_key=True, serialize=False
123
+ ),
124
+ ),
125
+ ("created", models.DateTimeField(auto_now_add=True, null=True)),
126
+ ("last_updated", models.DateTimeField(auto_now=True, null=True)),
127
+ (
128
+ "custom_field_data",
129
+ models.JSONField(
130
+ blank=True,
131
+ default=dict,
132
+ encoder=utilities.json.CustomFieldJSONEncoder,
133
+ ),
134
+ ),
135
+ ("name", models.CharField(max_length=255, unique=True)),
136
+ (
137
+ "tags",
138
+ taggit.managers.TaggableManager(
139
+ through="extras.TaggedItem", to="extras.Tag"
140
+ ),
141
+ ),
142
+ ("description", models.CharField(blank=True, max_length=200)),
143
+ ],
144
+ options={
145
+ "ordering": ("name",),
146
+ },
147
+ ),
148
+ migrations.CreateModel(
149
+ name="Zone",
150
+ fields=[
151
+ ("created", models.DateTimeField(auto_now_add=True, null=True)),
152
+ ("last_updated", models.DateTimeField(auto_now=True, null=True)),
153
+ (
154
+ "custom_field_data",
155
+ models.JSONField(
156
+ blank=True,
157
+ default=dict,
158
+ encoder=utilities.json.CustomFieldJSONEncoder,
159
+ ),
160
+ ),
161
+ (
162
+ "id",
163
+ models.BigAutoField(
164
+ auto_created=True, primary_key=True, serialize=False
165
+ ),
166
+ ),
167
+ ("name", models.CharField(max_length=255)),
168
+ (
169
+ "status",
170
+ models.CharField(blank=True, default="active", max_length=50),
171
+ ),
172
+ (
173
+ "nameservers",
174
+ models.ManyToManyField(
175
+ blank=True, related_name="zones", to="netbox_dns.nameserver"
176
+ ),
177
+ ),
178
+ (
179
+ "tags",
180
+ taggit.managers.TaggableManager(
181
+ through="extras.TaggedItem", to="extras.Tag"
182
+ ),
183
+ ),
184
+ ("description", models.CharField(blank=True, max_length=200)),
185
+ (
186
+ "view",
187
+ models.ForeignKey(
188
+ blank=True,
189
+ null=True,
190
+ on_delete=django.db.models.deletion.PROTECT,
191
+ to="netbox_dns.view",
192
+ ),
193
+ ),
194
+ (
195
+ "default_ttl",
196
+ models.PositiveIntegerField(
197
+ blank=True,
198
+ validators=[django.core.validators.MinValueValidator(1)],
199
+ ),
200
+ ),
201
+ (
202
+ "soa_expire",
203
+ models.PositiveIntegerField(
204
+ validators=[django.core.validators.MinValueValidator(1)]
205
+ ),
206
+ ),
207
+ (
208
+ "soa_minimum",
209
+ models.PositiveIntegerField(
210
+ validators=[django.core.validators.MinValueValidator(1)]
211
+ ),
212
+ ),
213
+ (
214
+ "soa_mname",
215
+ models.ForeignKey(
216
+ on_delete=django.db.models.deletion.PROTECT,
217
+ related_name="zones_soa",
218
+ to="netbox_dns.nameserver",
219
+ ),
220
+ ),
221
+ (
222
+ "soa_refresh",
223
+ models.PositiveIntegerField(
224
+ validators=[django.core.validators.MinValueValidator(1)]
225
+ ),
226
+ ),
227
+ (
228
+ "soa_retry",
229
+ models.PositiveIntegerField(
230
+ validators=[django.core.validators.MinValueValidator(1)]
231
+ ),
232
+ ),
233
+ ("soa_rname", models.CharField(max_length=255)),
234
+ (
235
+ "soa_serial",
236
+ models.BigIntegerField(
237
+ blank=True,
238
+ null=True,
239
+ validators=[
240
+ django.core.validators.MinValueValidator(1),
241
+ django.core.validators.MaxValueValidator(4294967295),
242
+ ],
243
+ ),
244
+ ),
245
+ (
246
+ "soa_ttl",
247
+ models.PositiveIntegerField(
248
+ validators=[django.core.validators.MinValueValidator(1)]
249
+ ),
250
+ ),
251
+ ("soa_serial_auto", models.BooleanField(default=True)),
252
+ (
253
+ "arpa_network",
254
+ netbox_dns.fields.network.NetworkField(blank=True, null=True),
255
+ ),
256
+ ],
257
+ options={
258
+ "ordering": ("view", "name"),
259
+ "unique_together": {("view", "name")},
260
+ },
261
+ ),
262
+ migrations.CreateModel(
263
+ name="Record",
264
+ fields=[
265
+ ("created", models.DateTimeField(auto_now_add=True, null=True)),
266
+ ("last_updated", models.DateTimeField(auto_now=True, null=True)),
267
+ (
268
+ "custom_field_data",
269
+ models.JSONField(
270
+ blank=True,
271
+ default=dict,
272
+ encoder=utilities.json.CustomFieldJSONEncoder,
273
+ ),
274
+ ),
275
+ (
276
+ "id",
277
+ models.BigAutoField(
278
+ auto_created=True, primary_key=True, serialize=False
279
+ ),
280
+ ),
281
+ ("type", models.CharField(max_length=10)),
282
+ ("name", models.CharField(max_length=255)),
283
+ ("value", models.CharField(max_length=1000)),
284
+ ("ttl", models.PositiveIntegerField(blank=True, null=True)),
285
+ (
286
+ "tags",
287
+ taggit.managers.TaggableManager(
288
+ through="extras.TaggedItem", to="extras.Tag"
289
+ ),
290
+ ),
291
+ (
292
+ "zone",
293
+ models.ForeignKey(
294
+ on_delete=django.db.models.deletion.CASCADE,
295
+ to="netbox_dns.zone",
296
+ ),
297
+ ),
298
+ ("status", models.CharField(default="active", max_length=50)),
299
+ ("description", models.CharField(blank=True, max_length=200)),
300
+ ("managed", models.BooleanField(default=False)),
301
+ ("disable_ptr", models.BooleanField(default=False)),
302
+ (
303
+ "ptr_record",
304
+ models.OneToOneField(
305
+ blank=True,
306
+ null=True,
307
+ on_delete=django.db.models.deletion.SET_NULL,
308
+ related_name="address_record",
309
+ to="netbox_dns.record",
310
+ ),
311
+ ),
312
+ (
313
+ "ip_address",
314
+ netbox_dns.fields.address.AddressField(blank=True, null=True),
315
+ ),
316
+ ],
317
+ options={
318
+ "ordering": ("zone", "name", "type", "value", "status"),
319
+ },
320
+ ),
321
+ migrations.AlterField(
322
+ model_name="record",
323
+ name="value",
324
+ field=models.CharField(max_length=65535),
325
+ ),
326
+ migrations.AddField(
327
+ model_name="nameserver",
328
+ name="tenant",
329
+ field=models.ForeignKey(
330
+ blank=True,
331
+ null=True,
332
+ on_delete=django.db.models.deletion.PROTECT,
333
+ related_name="netbox_dns_nameservers",
334
+ to="tenancy.tenant",
335
+ ),
336
+ ),
337
+ migrations.AddField(
338
+ model_name="record",
339
+ name="tenant",
340
+ field=models.ForeignKey(
341
+ blank=True,
342
+ null=True,
343
+ on_delete=django.db.models.deletion.PROTECT,
344
+ related_name="netbox_dns_records",
345
+ to="tenancy.tenant",
346
+ ),
347
+ ),
348
+ migrations.AddField(
349
+ model_name="view",
350
+ name="tenant",
351
+ field=models.ForeignKey(
352
+ blank=True,
353
+ null=True,
354
+ on_delete=django.db.models.deletion.PROTECT,
355
+ related_name="netbox_dns_views",
356
+ to="tenancy.tenant",
357
+ ),
358
+ ),
359
+ migrations.AddField(
360
+ model_name="zone",
361
+ name="tenant",
362
+ field=models.ForeignKey(
363
+ blank=True,
364
+ null=True,
365
+ on_delete=django.db.models.deletion.PROTECT,
366
+ related_name="netbox_dns_zones",
367
+ to="tenancy.tenant",
368
+ ),
369
+ ),
370
+ migrations.AddField(
371
+ model_name="record",
372
+ name="ipam_ip_address",
373
+ field=models.ForeignKey(
374
+ blank=True,
375
+ null=True,
376
+ on_delete=django.db.models.deletion.CASCADE,
377
+ related_name="netbox_dns_records",
378
+ to="ipam.ipaddress",
379
+ ),
380
+ ),
381
+ migrations.CreateModel(
382
+ name="Registrar",
383
+ fields=[
384
+ (
385
+ "id",
386
+ models.BigAutoField(
387
+ auto_created=True, primary_key=True, serialize=False
388
+ ),
389
+ ),
390
+ ("created", models.DateTimeField(auto_now_add=True, null=True)),
391
+ ("last_updated", models.DateTimeField(auto_now=True, null=True)),
392
+ (
393
+ "custom_field_data",
394
+ models.JSONField(
395
+ blank=True,
396
+ default=dict,
397
+ encoder=utilities.json.CustomFieldJSONEncoder,
398
+ ),
399
+ ),
400
+ ("name", models.CharField(max_length=255, unique=True)),
401
+ ("iana_id", models.IntegerField(blank=True, null=True)),
402
+ ("referral_url", models.URLField(blank=True, max_length=255)),
403
+ ("whois_server", models.CharField(blank=True, max_length=255)),
404
+ ("address", models.CharField(blank=True, max_length=200)),
405
+ ("abuse_email", models.EmailField(blank=True, max_length=254)),
406
+ ("abuse_phone", models.CharField(blank=True, max_length=50)),
407
+ (
408
+ "tags",
409
+ taggit.managers.TaggableManager(
410
+ through="extras.TaggedItem", to="extras.Tag"
411
+ ),
412
+ ),
413
+ ],
414
+ options={
415
+ "ordering": ("name", "iana_id"),
416
+ },
417
+ ),
418
+ migrations.CreateModel(
419
+ name="Contact",
420
+ fields=[
421
+ (
422
+ "id",
423
+ models.BigAutoField(
424
+ auto_created=True, primary_key=True, serialize=False
425
+ ),
426
+ ),
427
+ ("created", models.DateTimeField(auto_now_add=True, null=True)),
428
+ ("last_updated", models.DateTimeField(auto_now=True, null=True)),
429
+ (
430
+ "custom_field_data",
431
+ models.JSONField(
432
+ blank=True,
433
+ default=dict,
434
+ encoder=utilities.json.CustomFieldJSONEncoder,
435
+ ),
436
+ ),
437
+ ("name", models.CharField(blank=True, max_length=100)),
438
+ ("contact_id", models.CharField(max_length=50, unique=True)),
439
+ ("organization", models.CharField(blank=True, max_length=200)),
440
+ ("street", models.CharField(blank=True, max_length=50)),
441
+ ("city", models.CharField(blank=True, max_length=50)),
442
+ ("state_province", models.CharField(blank=True, max_length=255)),
443
+ ("postal_code", models.CharField(blank=True, max_length=20)),
444
+ ("country", models.CharField(blank=True, max_length=2)),
445
+ ("phone", models.CharField(blank=True, max_length=50)),
446
+ ("phone_ext", models.CharField(blank=True, max_length=50)),
447
+ ("fax", models.CharField(blank=True, max_length=50)),
448
+ ("fax_ext", models.CharField(blank=True, max_length=50)),
449
+ ("email", models.EmailField(blank=True, max_length=254)),
450
+ (
451
+ "tags",
452
+ taggit.managers.TaggableManager(
453
+ through="extras.TaggedItem", to="extras.Tag"
454
+ ),
455
+ ),
456
+ ],
457
+ options={
458
+ "ordering": ("name", "contact_id"),
459
+ },
460
+ ),
461
+ migrations.AddField(
462
+ model_name="zone",
463
+ name="admin_c",
464
+ field=models.ForeignKey(
465
+ blank=True,
466
+ null=True,
467
+ on_delete=django.db.models.deletion.SET_NULL,
468
+ related_name="admin_c_zones",
469
+ to="netbox_dns.contact",
470
+ ),
471
+ ),
472
+ migrations.AddField(
473
+ model_name="zone",
474
+ name="billing_c",
475
+ field=models.ForeignKey(
476
+ blank=True,
477
+ null=True,
478
+ on_delete=django.db.models.deletion.SET_NULL,
479
+ related_name="billing_c_zones",
480
+ to="netbox_dns.contact",
481
+ ),
482
+ ),
483
+ migrations.AddField(
484
+ model_name="zone",
485
+ name="registrant",
486
+ field=models.ForeignKey(
487
+ blank=True,
488
+ null=True,
489
+ on_delete=django.db.models.deletion.SET_NULL,
490
+ to="netbox_dns.contact",
491
+ ),
492
+ ),
493
+ migrations.AddField(
494
+ model_name="zone",
495
+ name="registrar",
496
+ field=models.ForeignKey(
497
+ blank=True,
498
+ null=True,
499
+ on_delete=django.db.models.deletion.SET_NULL,
500
+ to="netbox_dns.registrar",
501
+ ),
502
+ ),
503
+ migrations.AddField(
504
+ model_name="zone",
505
+ name="registry_domain_id",
506
+ field=models.CharField(blank=True, max_length=50, null=True),
507
+ ),
508
+ migrations.AddField(
509
+ model_name="zone",
510
+ name="tech_c",
511
+ field=models.ForeignKey(
512
+ blank=True,
513
+ null=True,
514
+ on_delete=django.db.models.deletion.SET_NULL,
515
+ related_name="tech_c_zones",
516
+ to="netbox_dns.contact",
517
+ ),
518
+ ),
519
+ migrations.AddField(
520
+ model_name="zone",
521
+ name="rfc2317_prefix",
522
+ field=netbox_dns.fields.rfc2317.RFC2317NetworkField(blank=True, null=True),
523
+ ),
524
+ migrations.AddField(
525
+ model_name="zone",
526
+ name="rfc2317_parent_managed",
527
+ field=models.BooleanField(default=False),
528
+ ),
529
+ migrations.AddField(
530
+ model_name="zone",
531
+ name="rfc2317_parent_zone",
532
+ field=models.ForeignKey(
533
+ blank=True,
534
+ null=True,
535
+ on_delete=django.db.models.deletion.SET_NULL,
536
+ related_name="rfc2317_child_zones",
537
+ to="netbox_dns.zone",
538
+ ),
539
+ ),
540
+ migrations.AddField(
541
+ model_name="record",
542
+ name="rfc2317_cname_record",
543
+ field=models.ForeignKey(
544
+ blank=True,
545
+ null=True,
546
+ on_delete=django.db.models.deletion.SET_NULL,
547
+ related_name="rfc2317_ptr_records",
548
+ to="netbox_dns.record",
549
+ ),
550
+ ),
551
+ migrations.RunPython(update_ip_addresses),
552
+ migrations.AddField(
553
+ model_name="record",
554
+ name="fqdn",
555
+ field=models.CharField(default=None, max_length=255, null=True, blank=True),
556
+ ),
557
+ migrations.RunPython(update_record_fqdn),
558
+ ]
@@ -1,26 +1,21 @@
1
- # Generated by Django 4.0.3 on 2022-07-17 17:41
1
+ # Generated by Django 5.0.1 on 2024-02-24 10:23
2
2
 
3
3
  from django.db import migrations, models
4
4
 
5
5
 
6
6
  class Migration(migrations.Migration):
7
7
  dependencies = [
8
- ("netbox_dns", "0001_initial"),
8
+ ("netbox_dns", "0001_squashed_netbox_dns_0_22"),
9
9
  ]
10
10
 
11
11
  operations = [
12
12
  migrations.AddField(
13
- model_name="nameserver",
13
+ model_name="contact",
14
14
  name="description",
15
15
  field=models.CharField(blank=True, max_length=200),
16
16
  ),
17
17
  migrations.AddField(
18
- model_name="record",
19
- name="description",
20
- field=models.CharField(blank=True, max_length=200),
21
- ),
22
- migrations.AddField(
23
- model_name="zone",
18
+ model_name="registrar",
24
19
  name="description",
25
20
  field=models.CharField(blank=True, max_length=200),
26
21
  ),
@@ -0,0 +1,15 @@
1
+ from django.db import migrations, models
2
+
3
+
4
+ class Migration(migrations.Migration):
5
+ dependencies = [
6
+ ("netbox_dns", "0002_contact_description_registrar_description"),
7
+ ]
8
+
9
+ operations = [
10
+ migrations.AddField(
11
+ model_name="view",
12
+ name="default_view",
13
+ field=models.BooleanField(default=False),
14
+ ),
15
+ ]
@@ -0,0 +1,26 @@
1
+ from django.db import migrations
2
+
3
+
4
+ def create_and_assign_default_view(apps, schema_editor):
5
+ View = apps.get_model("netbox_dns", "View")
6
+ Zone = apps.get_model("netbox_dns", "Zone")
7
+
8
+ default_view = View.objects.create(
9
+ name="_default_",
10
+ description="Default View",
11
+ default_view=True,
12
+ )
13
+
14
+ for zone in Zone.objects.filter(view=None):
15
+ zone.view = default_view
16
+ zone.save()
17
+
18
+
19
+ class Migration(migrations.Migration):
20
+ dependencies = [
21
+ ("netbox_dns", "0003_default_view"),
22
+ ]
23
+
24
+ operations = [
25
+ migrations.RunPython(create_and_assign_default_view),
26
+ ]
@@ -0,0 +1,18 @@
1
+ import django.db.models.deletion
2
+ from django.db import migrations, models
3
+
4
+
5
+ class Migration(migrations.Migration):
6
+ dependencies = [
7
+ ("netbox_dns", "0004_create_and_assign_default_view"),
8
+ ]
9
+
10
+ operations = [
11
+ migrations.AlterField(
12
+ model_name="zone",
13
+ name="view",
14
+ field=models.ForeignKey(
15
+ on_delete=django.db.models.deletion.PROTECT, to="netbox_dns.view"
16
+ ),
17
+ ),
18
+ ]
@@ -6,7 +6,7 @@ import utilities.json
6
6
 
7
7
  class Migration(migrations.Migration):
8
8
  dependencies = [
9
- ("netbox_dns", "0019_update_ns_ttl"),
9
+ ("netbox_dns", "0001_squashed_netbox_dns_0_15"),
10
10
  ]
11
11
 
12
12
  operations = [
@@ -20,6 +20,10 @@ class Contact(NetBoxModel):
20
20
  blank=True,
21
21
  max_length=100,
22
22
  )
23
+ description = models.CharField(
24
+ blank=True,
25
+ max_length=200,
26
+ )
23
27
  organization = models.CharField(
24
28
  blank=True,
25
29
  max_length=200,
@@ -79,6 +83,7 @@ class Contact(NetBoxModel):
79
83
 
80
84
  clone_fields = [
81
85
  "name",
86
+ "description",
82
87
  "organization",
83
88
  "street",
84
89
  "city",
@@ -94,7 +99,7 @@ class Contact(NetBoxModel):
94
99
  ]
95
100
 
96
101
  def get_absolute_url(self):
97
- return reverse("plugins:netbox_dns:contact", kwargs={"pk": self.id})
102
+ return reverse("plugins:netbox_dns:contact", kwargs={"pk": self.pk})
98
103
 
99
104
  def __str__(self):
100
105
  if self.name is not None:
@@ -39,6 +39,8 @@ class NameServer(NetBoxModel):
39
39
 
40
40
  class Meta:
41
41
  ordering = ("name",)
42
+ verbose_name = "Nameserver"
43
+ verbose_name_plural = "Nameservers"
42
44
 
43
45
  def __str__(self):
44
46
  try: