netbox-plugin-dns 1.0.6__py3-none-any.whl → 1.1.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 (94) hide show
  1. netbox_dns/__init__.py +23 -4
  2. netbox_dns/api/nested_serializers.py +17 -16
  3. netbox_dns/api/serializers.py +2 -1
  4. netbox_dns/api/serializers_/prefix.py +18 -0
  5. netbox_dns/api/serializers_/record.py +1 -0
  6. netbox_dns/api/serializers_/{contact.py → registration_contact.py} +5 -5
  7. netbox_dns/api/serializers_/view.py +34 -2
  8. netbox_dns/api/serializers_/zone.py +5 -5
  9. netbox_dns/api/serializers_/zone_template.py +5 -5
  10. netbox_dns/api/urls.py +5 -2
  11. netbox_dns/api/views.py +17 -35
  12. netbox_dns/fields/__init__.py +1 -0
  13. netbox_dns/fields/ipam.py +15 -0
  14. netbox_dns/filtersets/__init__.py +1 -1
  15. netbox_dns/filtersets/record.py +1 -1
  16. netbox_dns/filtersets/{contact.py → registration_contact.py} +4 -4
  17. netbox_dns/filtersets/view.py +16 -0
  18. netbox_dns/filtersets/zone.py +15 -15
  19. netbox_dns/filtersets/zone_template.py +15 -15
  20. netbox_dns/forms/__init__.py +1 -1
  21. netbox_dns/forms/{contact.py → registration_contact.py} +16 -16
  22. netbox_dns/forms/view.py +204 -4
  23. netbox_dns/forms/zone.py +15 -18
  24. netbox_dns/forms/zone_template.py +13 -13
  25. netbox_dns/graphql/__init__.py +2 -2
  26. netbox_dns/graphql/filters.py +5 -5
  27. netbox_dns/graphql/schema.py +24 -44
  28. netbox_dns/graphql/types.py +41 -12
  29. netbox_dns/management/commands/rebuild_dnssync.py +18 -0
  30. netbox_dns/management/commands/setup_dnssync.py +140 -0
  31. netbox_dns/migrations/0007_alter_ordering_options.py +25 -0
  32. netbox_dns/migrations/0008_view_prefixes.py +18 -0
  33. netbox_dns/migrations/0009_rename_contact_registrationcontact.py +27 -0
  34. netbox_dns/models/__init__.py +1 -3
  35. netbox_dns/models/nameserver.py +8 -3
  36. netbox_dns/models/record.py +154 -24
  37. netbox_dns/models/record_template.py +4 -1
  38. netbox_dns/models/registrar.py +7 -1
  39. netbox_dns/models/{contact.py → registration_contact.py} +15 -9
  40. netbox_dns/models/view.py +14 -2
  41. netbox_dns/models/zone.py +76 -35
  42. netbox_dns/models/zone_template.py +12 -9
  43. netbox_dns/navigation.py +7 -7
  44. netbox_dns/signals/ipam_dnssync.py +224 -0
  45. netbox_dns/tables/__init__.py +1 -1
  46. netbox_dns/tables/ipam_dnssync.py +11 -0
  47. netbox_dns/tables/nameserver.py +1 -7
  48. netbox_dns/tables/record.py +43 -30
  49. netbox_dns/tables/record_template.py +0 -17
  50. netbox_dns/tables/registrar.py +0 -2
  51. netbox_dns/tables/{contact.py → registration_contact.py} +5 -6
  52. netbox_dns/tables/view.py +19 -4
  53. netbox_dns/tables/zone.py +0 -15
  54. netbox_dns/tables/zone_template.py +2 -16
  55. netbox_dns/template_content.py +41 -40
  56. netbox_dns/templates/netbox_dns/record.html +6 -6
  57. netbox_dns/templates/netbox_dns/{contact.html → registrationcontact.html} +1 -1
  58. netbox_dns/templates/netbox_dns/view/button.html +9 -0
  59. netbox_dns/templates/netbox_dns/view/prefix.html +41 -0
  60. netbox_dns/templates/netbox_dns/view/related.html +17 -0
  61. netbox_dns/templates/netbox_dns/view.html +25 -0
  62. netbox_dns/urls/__init__.py +2 -2
  63. netbox_dns/urls/nameserver.py +14 -38
  64. netbox_dns/urls/record.py +7 -19
  65. netbox_dns/urls/record_template.py +18 -27
  66. netbox_dns/urls/registrar.py +11 -35
  67. netbox_dns/urls/registration_contact.py +60 -0
  68. netbox_dns/urls/view.py +12 -20
  69. netbox_dns/urls/zone.py +8 -46
  70. netbox_dns/urls/zone_template.py +16 -26
  71. netbox_dns/utilities/__init__.py +2 -74
  72. netbox_dns/utilities/conversions.py +83 -0
  73. netbox_dns/utilities/ipam_dnssync.py +295 -0
  74. netbox_dns/validators/dns_name.py +9 -0
  75. netbox_dns/views/__init__.py +1 -1
  76. netbox_dns/views/nameserver.py +7 -3
  77. netbox_dns/views/record.py +12 -7
  78. netbox_dns/views/record_template.py +1 -1
  79. netbox_dns/views/registrar.py +0 -1
  80. netbox_dns/views/registration_contact.py +94 -0
  81. netbox_dns/views/view.py +32 -2
  82. netbox_dns/views/zone.py +7 -6
  83. netbox_dns/views/zone_template.py +2 -2
  84. {netbox_plugin_dns-1.0.6.dist-info → netbox_plugin_dns-1.1.0.dist-info}/METADATA +2 -1
  85. netbox_plugin_dns-1.1.0.dist-info/RECORD +146 -0
  86. netbox_dns/management/commands/setup_coupling.py +0 -109
  87. netbox_dns/signals/ipam_coupling.py +0 -168
  88. netbox_dns/templates/netbox_dns/related_dns_objects.html +0 -21
  89. netbox_dns/urls/contact.py +0 -51
  90. netbox_dns/utilities/ipam_coupling.py +0 -112
  91. netbox_dns/views/contact.py +0 -95
  92. netbox_plugin_dns-1.0.6.dist-info/RECORD +0 -136
  93. {netbox_plugin_dns-1.0.6.dist-info → netbox_plugin_dns-1.1.0.dist-info}/LICENSE +0 -0
  94. {netbox_plugin_dns-1.0.6.dist-info → netbox_plugin_dns-1.1.0.dist-info}/WHEEL +0 -0
@@ -1,9 +1,13 @@
1
+ from django.conf import settings
2
+ from django.urls import reverse
3
+
1
4
  from netbox.plugins.utils import get_plugin_config
2
5
  from netbox.plugins import PluginTemplateExtension
3
6
 
4
- from netbox_dns.models import Record, Zone, View, NameServer
7
+ from netbox_dns.models import Record
5
8
  from netbox_dns.choices import RecordTypeChoices
6
- from netbox_dns.tables import RelatedRecordTable
9
+ from netbox_dns.tables import RelatedRecordTable, RelatedViewTable
10
+ from netbox_dns.utilities import get_views_by_prefix
7
11
 
8
12
 
9
13
  class RelatedDNSRecords(PluginTemplateExtension):
@@ -42,6 +46,36 @@ class RelatedDNSRecords(PluginTemplateExtension):
42
46
  )
43
47
 
44
48
 
49
+ class RelatedDNSViews(PluginTemplateExtension):
50
+ model = "ipam.prefix"
51
+
52
+ def right_page(self):
53
+ prefix = self.context.get("object")
54
+
55
+ if assigned_views := prefix.netbox_dns_views.all():
56
+ context = {"assigned_views": RelatedViewTable(data=assigned_views)}
57
+ elif inherited_views := get_views_by_prefix(prefix):
58
+ context = {"inherited_views": RelatedViewTable(data=inherited_views)}
59
+ else:
60
+ context = {}
61
+
62
+ return self.render(
63
+ "netbox_dns/view/related.html",
64
+ extra_context=context,
65
+ )
66
+
67
+ def buttons(self):
68
+ return self.render(
69
+ "netbox_dns/view/button.html",
70
+ extra_context={
71
+ "url": reverse(
72
+ "plugins:netbox_dns:prefix_views",
73
+ kwargs={"pk": self.context.get("object").pk},
74
+ ),
75
+ },
76
+ )
77
+
78
+
45
79
  class IPRelatedDNSRecords(PluginTemplateExtension):
46
80
  model = "ipam.ipaddress"
47
81
 
@@ -80,43 +114,10 @@ class IPRelatedDNSRecords(PluginTemplateExtension):
80
114
  )
81
115
 
82
116
 
83
- class RelatedDNSObjects(PluginTemplateExtension):
84
- model = "tenancy.tenant"
85
-
86
- def left_page(self):
87
- obj = self.context.get("object")
88
- request = self.context.get("request")
89
-
90
- related_dns_models = (
91
- (
92
- View.objects.restrict(request.user, "view").filter(tenant=obj),
93
- "tenant_id",
94
- ),
95
- (
96
- NameServer.objects.restrict(request.user, "view").filter(tenant=obj),
97
- "tenant_id",
98
- ),
99
- (
100
- Zone.objects.restrict(request.user, "view").filter(tenant=obj),
101
- "tenant_id",
102
- ),
103
- (
104
- Record.objects.restrict(request.user, "view").filter(tenant=obj),
105
- "tenant_id",
106
- ),
107
- )
108
-
109
- return self.render(
110
- "netbox_dns/related_dns_objects.html",
111
- extra_context={
112
- "related_dns_models": related_dns_models,
113
- },
114
- )
115
-
116
-
117
- template_extensions = []
117
+ if not settings.PLUGINS_CONFIG["netbox_dns"].get("dnssync_disabled"):
118
+ template_extensions = [RelatedDNSRecords, RelatedDNSViews]
119
+ else:
120
+ template_extensions = []
118
121
 
119
- if get_plugin_config("netbox_dns", "feature_ipam_coupling"):
120
- template_extensions.append(RelatedDNSRecords)
121
- elif get_plugin_config("netbox_dns", "feature_ipam_dns_info"):
122
+ if get_plugin_config("netbox_dns", "feature_ipam_dns_info"):
122
123
  template_extensions.append(IPRelatedDNSRecords)
@@ -102,12 +102,12 @@
102
102
  <th scope="row">Address Record</th>
103
103
  <td>{{ object.address_record|linkify }}</td>
104
104
  </tr>
105
- {% if object.address_record.ipam_ip_address %}
106
- <tr>
107
- <th scope="row">IPAM IP Address</th>
108
- <td>{{ object.address_record.ipam_ip_address|linkify }}</td>
109
- </tr>
110
- {% endif %}
105
+ {% if object.address_record.ipam_ip_address %}
106
+ <tr>
107
+ <th scope="row">IPAM IP Address</th>
108
+ <td>{{ object.address_record.ipam_ip_address|linkify }}</td>
109
+ </tr>
110
+ {% endif %}
111
111
  {% endif %}
112
112
  {% if object.ipam_ip_address %}
113
113
  <tr>
@@ -4,7 +4,7 @@
4
4
  <div class="row">
5
5
  <div class="col col-md-6">
6
6
  <div class="card">
7
- <h5 class="card-header">Contact</h5>
7
+ <h5 class="card-header">Registration Contact</h5>
8
8
  <table class="table table-hover attr-table">
9
9
  <tr>
10
10
  <th scope="row">Name</th>
@@ -0,0 +1,9 @@
1
+ {% load perms %}
2
+
3
+ {% if perms.netbox_dns.change_view %}
4
+ <a href="{{ url }}?return_url={{ object.get_absolute_url }}">
5
+ <button type="submit" class="btn btn-primary" name="assign-view">
6
+ <i class="mdi mdi-eye-outline" aria-hidden="true"></i> DNS Views
7
+ </button>
8
+ </a>
9
+ {% endif %}
@@ -0,0 +1,41 @@
1
+ {% extends 'generic/_base.html' %}
2
+
3
+ {% block title %}
4
+ Configure DNS views for {{ object|meta:"verbose_name" }} {{ object }} {% if object.vrf %}[{{ object.vrf }}]{% endif %}
5
+ {% endblock title %}
6
+
7
+ {% block content %}
8
+ <div class="tab-pane show active" id="edit-form" role="tabpanel" aria-labelledby="object-list-tab">
9
+
10
+ <form action="" method="post" enctype="multipart/form-data" class="object-edit mt-5">
11
+ {% csrf_token %}
12
+
13
+ <div id="form_fields" hx-disinherit="hx-select hx-swap">
14
+ {% if inherited_from %}
15
+ <div class="card">
16
+ <table class="table table-hover attr-table">
17
+ <th>Views inherited from prefix {{ inherited_from }} {% if inherited_from.vrf %}[{{ inherited_from.vrf }}] {% endif %}</th>
18
+ {% for view in inherited_views %}
19
+ <tr><td>{{ view|linkify }}</td><td>{{ view.description }}</td></tr>
20
+ {% endfor %}
21
+ </table>
22
+ </div>
23
+ {% endif %}
24
+ {% block form %}
25
+ {% include 'htmx/form.html' %}
26
+ {% endblock form %}
27
+ </div>
28
+
29
+ <div class="text-end my-3">
30
+ {% block buttons %}
31
+ <a href="{{ return_url }}" class="btn btn-outline-secondary">Cancel</a>
32
+ <button type="submit" name="_update" class="btn btn-primary">Save</button>
33
+ {% endblock buttons %}
34
+ </div>
35
+ </form>
36
+ </div>
37
+ {% endblock content %}
38
+
39
+ {% block modals %}
40
+ {% include 'inc/htmx_modal.html' with size='lg' %}
41
+ {% endblock %}
@@ -0,0 +1,17 @@
1
+ {% load perms %}
2
+
3
+ {% if perms.netbox_dns.view_view %}
4
+ {% if assigned_views %}
5
+ {% if assigned_views.rows|length == 1 %}
6
+ {% include 'inc/panel_table.html' with table=assigned_views heading='Assigned DNS View' %}
7
+ {% else %}
8
+ {% include 'inc/panel_table.html' with table=assigned_views heading='Assigned DNS Views' %}
9
+ {% endif %}
10
+ {% elif inherited_views %}
11
+ {% if inherited_views.rows|length == 1 %}
12
+ {% include 'inc/panel_table.html' with table=inherited_views heading='Inherited DNS View' %}
13
+ {% else %}
14
+ {% include 'inc/panel_table.html' with table=inherited_views heading='Inherited DNS Views' %}
15
+ {% endif %}
16
+ {% endif %}
17
+ {% endif %}
@@ -35,6 +35,31 @@
35
35
  </div>
36
36
  <div class="col col-md-6">
37
37
  {% include 'inc/panels/tags.html' %}
38
+ {% if not settings.PLUGINS_CONFIG.netbox_dns.dnssync_disabled %}
39
+ <div class="card">
40
+ <h5 class="card-header">
41
+ IPAM Prefixes
42
+ </h5>
43
+ <div class="card-body">
44
+ <table class="table table-hover attr-table">
45
+ {% for prefix in object.prefixes.all %}
46
+ <tr>
47
+ <td>
48
+ {{ prefix|linkify }}
49
+ </td>
50
+ {% if prefix.vrf %}
51
+ <td>
52
+ {{ prefix.vrf|linkify }}
53
+ </td>
54
+ {% else %}
55
+ <td>Global</td>
56
+ {% endif %}
57
+ </tr>
58
+ {% endfor %}
59
+ </table>
60
+ </div>
61
+ </div>
62
+ {% endif %}
38
63
  </div>
39
64
  </div>
40
65
  {% endblock %}
@@ -1,4 +1,4 @@
1
- from .contact import contact_urlpatterns
1
+ from .registration_contact import registrationcontact_urlpatterns
2
2
  from .nameserver import nameserver_urlpatterns
3
3
  from .record import record_urlpatterns
4
4
  from .record_template import recordtemplate_urlpatterns
@@ -10,7 +10,7 @@ from .zone_template import zonetemplate_urlpatterns
10
10
  app_name = "netbox_dns"
11
11
 
12
12
  urlpatterns = (
13
- contact_urlpatterns
13
+ registrationcontact_urlpatterns
14
14
  + nameserver_urlpatterns
15
15
  + record_urlpatterns
16
16
  + recordtemplate_urlpatterns
@@ -1,39 +1,21 @@
1
- from django.urls import path
1
+ from django.urls import include, path
2
2
 
3
- from netbox.views.generic import ObjectChangeLogView, ObjectJournalView
3
+ from utilities.urls import get_model_urls
4
4
 
5
- from netbox_dns.models import NameServer
6
5
  from netbox_dns.views import (
7
- NameServerListView,
8
6
  NameServerView,
7
+ NameServerListView,
9
8
  NameServerEditView,
10
9
  NameServerDeleteView,
11
10
  NameServerBulkImportView,
12
11
  NameServerBulkEditView,
13
12
  NameServerBulkDeleteView,
14
- NameServerZoneListView,
15
- NameServerSOAZoneListView,
16
13
  )
17
14
 
18
15
  nameserver_urlpatterns = [
16
+ path("nameservers/<int:pk>/", NameServerView.as_view(), name="nameserver"),
19
17
  path("nameservers/", NameServerListView.as_view(), name="nameserver_list"),
20
18
  path("nameservers/add/", NameServerEditView.as_view(), name="nameserver_add"),
21
- path(
22
- "nameservers/import/",
23
- NameServerBulkImportView.as_view(),
24
- name="nameserver_import",
25
- ),
26
- path(
27
- "nameservers/edit/",
28
- NameServerBulkEditView.as_view(),
29
- name="nameserver_bulk_edit",
30
- ),
31
- path(
32
- "nameservers/delete/",
33
- NameServerBulkDeleteView.as_view(),
34
- name="nameserver_bulk_delete",
35
- ),
36
- path("nameservers/<int:pk>/", NameServerView.as_view(), name="nameserver"),
37
19
  path(
38
20
  "nameservers/<int:pk>/edit",
39
21
  NameServerEditView.as_view(),
@@ -45,25 +27,19 @@ nameserver_urlpatterns = [
45
27
  name="nameserver_delete",
46
28
  ),
47
29
  path(
48
- "nameservers/<int:pk>/journal/",
49
- ObjectJournalView.as_view(),
50
- name="nameserver_journal",
51
- kwargs={"model": NameServer},
52
- ),
53
- path(
54
- "nameservers/<int:pk>/changelog/",
55
- ObjectChangeLogView.as_view(),
56
- name="nameserver_changelog",
57
- kwargs={"model": NameServer},
30
+ "nameservers/import/",
31
+ NameServerBulkImportView.as_view(),
32
+ name="nameserver_import",
58
33
  ),
59
34
  path(
60
- "nameservers/<int:pk>/zones/",
61
- NameServerZoneListView.as_view(),
62
- name="nameserver_zones",
35
+ "nameservers/edit/",
36
+ NameServerBulkEditView.as_view(),
37
+ name="nameserver_bulk_edit",
63
38
  ),
64
39
  path(
65
- "nameservers/<int:pk>/soazones/",
66
- NameServerSOAZoneListView.as_view(),
67
- name="nameserver_soa_zones",
40
+ "nameservers/delete/",
41
+ NameServerBulkDeleteView.as_view(),
42
+ name="nameserver_bulk_delete",
68
43
  ),
44
+ path("nameservers/<int:pk>/", include(get_model_urls("netbox_dns", "nameserver"))),
69
45
  ]
netbox_dns/urls/record.py CHANGED
@@ -1,11 +1,10 @@
1
- from django.urls import path
1
+ from django.urls import include, path
2
2
 
3
- from netbox.views.generic import ObjectChangeLogView, ObjectJournalView
3
+ from utilities.urls import get_model_urls
4
4
 
5
- from netbox_dns.models import Record
6
5
  from netbox_dns.views import (
7
- RecordListView,
8
6
  RecordView,
7
+ RecordListView,
9
8
  RecordEditView,
10
9
  RecordDeleteView,
11
10
  RecordBulkImportView,
@@ -15,26 +14,15 @@ from netbox_dns.views import (
15
14
  )
16
15
 
17
16
  record_urlpatterns = [
17
+ path("records/<int:pk>/", RecordView.as_view(), name="record"),
18
18
  path("records/", RecordListView.as_view(), name="record_list"),
19
19
  path("records/add/", RecordEditView.as_view(), name="record_add"),
20
+ path("records/<int:pk>/edit/", RecordEditView.as_view(), name="record_edit"),
21
+ path("records/<int:pk>/delete/", RecordDeleteView.as_view(), name="record_delete"),
20
22
  path("records/import/", RecordBulkImportView.as_view(), name="record_import"),
21
23
  path("records/edit/", RecordBulkEditView.as_view(), name="record_bulk_edit"),
22
24
  path("records/delete/", RecordBulkDeleteView.as_view(), name="record_bulk_delete"),
23
- path("records/<int:pk>/", RecordView.as_view(), name="record"),
24
- path("records/<int:pk>/edit/", RecordEditView.as_view(), name="record_edit"),
25
- path("records/<int:pk>/delete/", RecordDeleteView.as_view(), name="record_delete"),
26
- path(
27
- "records/<int:pk>/journal/",
28
- ObjectJournalView.as_view(),
29
- name="record_journal",
30
- kwargs={"model": Record},
31
- ),
32
- path(
33
- "records/<int:pk>/changelog/",
34
- ObjectChangeLogView.as_view(),
35
- name="record_changelog",
36
- kwargs={"model": Record},
37
- ),
25
+ path("records/<int:pk>/", include(get_model_urls("netbox_dns", "record"))),
38
26
  path(
39
27
  "managedrecords/", ManagedRecordListView.as_view(), name="managed_record_list"
40
28
  ),
@@ -1,11 +1,10 @@
1
- from django.urls import path
1
+ from django.urls import include, path
2
2
 
3
- from netbox.views.generic import ObjectChangeLogView, ObjectJournalView
3
+ from utilities.urls import get_model_urls
4
4
 
5
- from netbox_dns.models import RecordTemplate
6
5
  from netbox_dns.views import (
7
- RecordTemplateListView,
8
6
  RecordTemplateView,
7
+ RecordTemplateListView,
9
8
  RecordTemplateEditView,
10
9
  RecordTemplateDeleteView,
11
10
  RecordTemplateBulkImportView,
@@ -14,6 +13,9 @@ from netbox_dns.views import (
14
13
  )
15
14
 
16
15
  recordtemplate_urlpatterns = [
16
+ path(
17
+ "recordtemplates/<int:pk>/", RecordTemplateView.as_view(), name="recordtemplate"
18
+ ),
17
19
  path(
18
20
  "recordtemplates/", RecordTemplateListView.as_view(), name="recordtemplate_list"
19
21
  ),
@@ -22,6 +24,16 @@ recordtemplate_urlpatterns = [
22
24
  RecordTemplateEditView.as_view(),
23
25
  name="recordtemplate_add",
24
26
  ),
27
+ path(
28
+ "recordtemplates/<int:pk>/edit/",
29
+ RecordTemplateEditView.as_view(),
30
+ name="recordtemplate_edit",
31
+ ),
32
+ path(
33
+ "recordtemplates/<int:pk>/delete/",
34
+ RecordTemplateDeleteView.as_view(),
35
+ name="recordtemplate_delete",
36
+ ),
25
37
  path(
26
38
  "recordtemplates/import/",
27
39
  RecordTemplateBulkImportView.as_view(),
@@ -38,28 +50,7 @@ recordtemplate_urlpatterns = [
38
50
  name="recordtemplate_bulk_delete",
39
51
  ),
40
52
  path(
41
- "recordtemplates/<int:pk>/", RecordTemplateView.as_view(), name="recordtemplate"
42
- ),
43
- path(
44
- "recordtemplates/<int:pk>/edit/",
45
- RecordTemplateEditView.as_view(),
46
- name="recordtemplate_edit",
47
- ),
48
- path(
49
- "recordtemplates/<int:pk>/delete/",
50
- RecordTemplateDeleteView.as_view(),
51
- name="recordtemplate_delete",
52
- ),
53
- path(
54
- "recordtemplates/<int:pk>/journal/",
55
- ObjectJournalView.as_view(),
56
- name="recordtemplate_journal",
57
- kwargs={"model": RecordTemplate},
58
- ),
59
- path(
60
- "recordtemplates/<int:pk>/changelog/",
61
- ObjectChangeLogView.as_view(),
62
- name="recordtemplate_changelog",
63
- kwargs={"model": RecordTemplate},
53
+ "recordtemplates/<int:pk>/",
54
+ include(get_model_urls("netbox_dns", "recordtemplate")),
64
55
  ),
65
56
  ]
@@ -1,63 +1,39 @@
1
- from django.urls import path
1
+ from django.urls import include, path
2
2
 
3
- from netbox.views.generic import ObjectChangeLogView, ObjectJournalView
3
+ from utilities.urls import get_model_urls
4
4
 
5
- from netbox_dns.models import Registrar
6
5
  from netbox_dns.views import (
7
- RegistrarListView,
8
6
  RegistrarView,
9
- RegistrarDeleteView,
7
+ RegistrarListView,
10
8
  RegistrarEditView,
9
+ RegistrarDeleteView,
11
10
  RegistrarBulkImportView,
12
11
  RegistrarBulkEditView,
13
12
  RegistrarBulkDeleteView,
14
- RegistrarZoneListView,
15
13
  )
16
14
 
17
15
  registrar_urlpatterns = [
16
+ path("registrars/<int:pk>/", RegistrarView.as_view(), name="registrar"),
18
17
  path("registrars/", RegistrarListView.as_view(), name="registrar_list"),
19
18
  path("registrars/add/", RegistrarEditView.as_view(), name="registrar_add"),
20
19
  path(
21
- "registrars/import/",
22
- RegistrarBulkImportView.as_view(),
23
- name="registrar_import",
24
- ),
25
- path(
26
- "registrars/edit/",
27
- RegistrarBulkEditView.as_view(),
28
- name="registrar_bulk_edit",
20
+ "registrars/<int:pk>/edit/", RegistrarEditView.as_view(), name="registrar_edit"
29
21
  ),
30
22
  path(
31
23
  "registrars/delete/",
32
24
  RegistrarBulkDeleteView.as_view(),
33
25
  name="registrar_bulk_delete",
34
26
  ),
35
- path("registrars/<int:pk>/", RegistrarView.as_view(), name="registrar"),
36
27
  path(
37
- "registrars/<int:pk>/edit/",
38
- RegistrarEditView.as_view(),
39
- name="registrar_edit",
28
+ "registrars/import/", RegistrarBulkImportView.as_view(), name="registrar_import"
29
+ ),
30
+ path(
31
+ "registrars/edit/", RegistrarBulkEditView.as_view(), name="registrar_bulk_edit"
40
32
  ),
41
33
  path(
42
34
  "registrars/<int:pk>/delete/",
43
35
  RegistrarDeleteView.as_view(),
44
36
  name="registrar_delete",
45
37
  ),
46
- path(
47
- "registrars/<int:pk>/zones/",
48
- RegistrarZoneListView.as_view(),
49
- name="registrar_zones",
50
- ),
51
- path(
52
- "registrars/<int:pk>/journal/",
53
- ObjectJournalView.as_view(),
54
- name="registrar_journal",
55
- kwargs={"model": Registrar},
56
- ),
57
- path(
58
- "registrars/<int:pk>/changelog/",
59
- ObjectChangeLogView.as_view(),
60
- name="registrar_changelog",
61
- kwargs={"model": Registrar},
62
- ),
38
+ path("registrars/<int:pk>/", include(get_model_urls("netbox_dns", "registrar"))),
63
39
  ]
@@ -0,0 +1,60 @@
1
+ from django.urls import include, path
2
+
3
+ from utilities.urls import get_model_urls
4
+
5
+ from netbox_dns.views import (
6
+ RegistrationContactView,
7
+ RegistrationContactListView,
8
+ RegistrationContactEditView,
9
+ RegistrationContactDeleteView,
10
+ RegistrationContactBulkImportView,
11
+ RegistrationContactBulkEditView,
12
+ RegistrationContactBulkDeleteView,
13
+ )
14
+
15
+ registrationcontact_urlpatterns = [
16
+ path(
17
+ "registrationcontacts/<int:pk>/",
18
+ RegistrationContactView.as_view(),
19
+ name="registrationcontact",
20
+ ),
21
+ path(
22
+ "registrationcontacts/",
23
+ RegistrationContactListView.as_view(),
24
+ name="registrationcontact_list",
25
+ ),
26
+ path(
27
+ "registrationcontacts/add/",
28
+ RegistrationContactEditView.as_view(),
29
+ name="registrationcontact_add",
30
+ ),
31
+ path(
32
+ "registrationcontacts/<int:pk>/edit/",
33
+ RegistrationContactEditView.as_view(),
34
+ name="registrationcontact_edit",
35
+ ),
36
+ path(
37
+ "registrationcontacts/<int:pk>/delete/",
38
+ RegistrationContactDeleteView.as_view(),
39
+ name="registrationcontact_delete",
40
+ ),
41
+ path(
42
+ "registrationcontacts/import/",
43
+ RegistrationContactBulkImportView.as_view(),
44
+ name="registrationcontact_import",
45
+ ),
46
+ path(
47
+ "registrationcontacts/edit/",
48
+ RegistrationContactBulkEditView.as_view(),
49
+ name="registrationcontact_bulk_edit",
50
+ ),
51
+ path(
52
+ "registrationcontacts/delete/",
53
+ RegistrationContactBulkDeleteView.as_view(),
54
+ name="registrationcontact_bulk_delete",
55
+ ),
56
+ path(
57
+ "registrationcontacts/<int:pk>/",
58
+ include(get_model_urls("netbox_dns", "registrationcontact")),
59
+ ),
60
+ ]
netbox_dns/urls/view.py CHANGED
@@ -1,39 +1,31 @@
1
- from django.urls import path
1
+ from django.urls import include, path
2
2
 
3
- from netbox.views.generic import ObjectChangeLogView, ObjectJournalView
3
+ from utilities.urls import get_model_urls
4
4
 
5
- from netbox_dns.models import View
6
5
  from netbox_dns.views import (
7
- ViewListView,
8
6
  ViewView,
9
- ViewDeleteView,
7
+ ViewListView,
10
8
  ViewEditView,
9
+ ViewDeleteView,
11
10
  ViewBulkImportView,
12
11
  ViewBulkEditView,
13
12
  ViewBulkDeleteView,
14
- ViewZoneListView,
13
+ ViewPrefixEditView,
15
14
  )
16
15
 
17
16
  view_urlpatterns = [
17
+ path("views/<int:pk>/", ViewView.as_view(), name="view"),
18
18
  path("views/", ViewListView.as_view(), name="view_list"),
19
19
  path("views/add/", ViewEditView.as_view(), name="view_add"),
20
+ path("views/<int:pk>/edit/", ViewEditView.as_view(), name="view_edit"),
21
+ path("views/<int:pk>/delete/", ViewDeleteView.as_view(), name="view_delete"),
20
22
  path("views/import/", ViewBulkImportView.as_view(), name="view_import"),
21
23
  path("views/edit/", ViewBulkEditView.as_view(), name="view_bulk_edit"),
22
24
  path("views/delete/", ViewBulkDeleteView.as_view(), name="view_bulk_delete"),
23
- path("views/<int:pk>/", ViewView.as_view(), name="view"),
24
- path("views/<int:pk>/edit/", ViewEditView.as_view(), name="view_edit"),
25
- path("views/<int:pk>/delete/", ViewDeleteView.as_view(), name="view_delete"),
26
- path("views/<int:pk>/zones/", ViewZoneListView.as_view(), name="view_zones"),
27
- path(
28
- "views/<int:pk>/journal/",
29
- ObjectJournalView.as_view(),
30
- name="view_journal",
31
- kwargs={"model": View},
32
- ),
25
+ path("views/<int:pk>/", include(get_model_urls("netbox_dns", "view"))),
33
26
  path(
34
- "views/<int:pk>/changelog/",
35
- ObjectChangeLogView.as_view(),
36
- name="view_changelog",
37
- kwargs={"model": View},
27
+ "prefixes/<int:pk>/assign-views/",
28
+ ViewPrefixEditView.as_view(),
29
+ name="prefix_views",
38
30
  ),
39
31
  ]