netbox-plugin-dns 0.21.4__py3-none-any.whl → 1.4.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. netbox_dns/__init__.py +106 -41
  2. netbox_dns/api/field_serializers.py +25 -0
  3. netbox_dns/api/nested_serializers.py +95 -52
  4. netbox_dns/api/serializers.py +14 -296
  5. netbox_dns/api/serializers_/__init__.py +0 -0
  6. netbox_dns/api/serializers_/dnssec_key_template.py +69 -0
  7. netbox_dns/api/serializers_/dnssec_policy.py +165 -0
  8. netbox_dns/api/serializers_/nameserver.py +56 -0
  9. netbox_dns/api/serializers_/prefix.py +18 -0
  10. netbox_dns/api/serializers_/record.py +105 -0
  11. netbox_dns/api/serializers_/record_template.py +71 -0
  12. netbox_dns/api/serializers_/registrar.py +45 -0
  13. netbox_dns/api/serializers_/registration_contact.py +50 -0
  14. netbox_dns/api/serializers_/view.py +81 -0
  15. netbox_dns/api/serializers_/zone.py +247 -0
  16. netbox_dns/api/serializers_/zone_template.py +157 -0
  17. netbox_dns/api/urls.py +13 -2
  18. netbox_dns/api/views.py +96 -58
  19. netbox_dns/choices/__init__.py +4 -0
  20. netbox_dns/choices/dnssec_key_template.py +67 -0
  21. netbox_dns/choices/dnssec_policy.py +40 -0
  22. netbox_dns/choices/record.py +104 -0
  23. netbox_dns/choices/utilities.py +4 -0
  24. netbox_dns/choices/zone.py +119 -0
  25. netbox_dns/fields/__init__.py +4 -0
  26. netbox_dns/fields/address.py +22 -16
  27. netbox_dns/fields/choice_array.py +33 -0
  28. netbox_dns/fields/ipam.py +15 -0
  29. netbox_dns/fields/network.py +42 -18
  30. netbox_dns/fields/rfc2317.py +97 -0
  31. netbox_dns/fields/timeperiod.py +33 -0
  32. netbox_dns/filters.py +7 -0
  33. netbox_dns/filtersets/__init__.py +12 -0
  34. netbox_dns/filtersets/dnssec_key_template.py +57 -0
  35. netbox_dns/filtersets/dnssec_policy.py +101 -0
  36. netbox_dns/filtersets/nameserver.py +46 -0
  37. netbox_dns/filtersets/record.py +135 -0
  38. netbox_dns/filtersets/record_template.py +59 -0
  39. netbox_dns/{filters → filtersets}/registrar.py +8 -1
  40. netbox_dns/{filters/contact.py → filtersets/registration_contact.py} +9 -3
  41. netbox_dns/filtersets/view.py +45 -0
  42. netbox_dns/filtersets/zone.py +254 -0
  43. netbox_dns/filtersets/zone_template.py +165 -0
  44. netbox_dns/forms/__init__.py +5 -1
  45. netbox_dns/forms/dnssec_key_template.py +250 -0
  46. netbox_dns/forms/dnssec_policy.py +654 -0
  47. netbox_dns/forms/nameserver.py +121 -27
  48. netbox_dns/forms/record.py +215 -104
  49. netbox_dns/forms/record_template.py +285 -0
  50. netbox_dns/forms/registrar.py +108 -31
  51. netbox_dns/forms/registration_contact.py +282 -0
  52. netbox_dns/forms/view.py +331 -20
  53. netbox_dns/forms/zone.py +769 -373
  54. netbox_dns/forms/zone_template.py +463 -0
  55. netbox_dns/graphql/__init__.py +25 -22
  56. netbox_dns/graphql/enums.py +41 -0
  57. netbox_dns/graphql/filter_lookups.py +13 -0
  58. netbox_dns/graphql/filters/__init__.py +12 -0
  59. netbox_dns/graphql/filters/dnssec_key_template.py +63 -0
  60. netbox_dns/graphql/filters/dnssec_policy.py +124 -0
  61. netbox_dns/graphql/filters/nameserver.py +32 -0
  62. netbox_dns/graphql/filters/record.py +89 -0
  63. netbox_dns/graphql/filters/record_template.py +55 -0
  64. netbox_dns/graphql/filters/registrar.py +30 -0
  65. netbox_dns/graphql/filters/registration_contact.py +27 -0
  66. netbox_dns/graphql/filters/view.py +28 -0
  67. netbox_dns/graphql/filters/zone.py +147 -0
  68. netbox_dns/graphql/filters/zone_template.py +97 -0
  69. netbox_dns/graphql/schema.py +89 -7
  70. netbox_dns/graphql/types.py +355 -0
  71. netbox_dns/locale/de/LC_MESSAGES/django.mo +0 -0
  72. netbox_dns/locale/en/LC_MESSAGES/django.mo +0 -0
  73. netbox_dns/locale/fr/LC_MESSAGES/django.mo +0 -0
  74. netbox_dns/management/commands/cleanup_database.py +175 -156
  75. netbox_dns/management/commands/cleanup_rrset_ttl.py +64 -0
  76. netbox_dns/management/commands/rebuild_dnssync.py +23 -0
  77. netbox_dns/management/commands/setup_dnssync.py +140 -0
  78. netbox_dns/migrations/0001_squashed_netbox_dns_0_15.py +0 -27
  79. netbox_dns/migrations/0001_squashed_netbox_dns_0_22.py +557 -0
  80. netbox_dns/migrations/{0013_add_nameserver_zone_record_description.py → 0002_contact_description_registrar_description.py} +4 -9
  81. netbox_dns/migrations/0003_default_view.py +15 -0
  82. netbox_dns/migrations/0004_create_and_assign_default_view.py +26 -0
  83. netbox_dns/migrations/0005_alter_zone_view_not_null.py +18 -0
  84. netbox_dns/migrations/0006_templating.py +172 -0
  85. netbox_dns/migrations/0007_alter_ordering_options.py +25 -0
  86. netbox_dns/migrations/0008_view_prefixes.py +18 -0
  87. netbox_dns/migrations/0009_rename_contact_registrationcontact.py +36 -0
  88. netbox_dns/migrations/0010_view_ip_address_filter.py +18 -0
  89. netbox_dns/migrations/0011_rename_related_fields.py +63 -0
  90. netbox_dns/migrations/0012_natural_ordering.py +88 -0
  91. netbox_dns/migrations/0013_zonetemplate_soa_mname_zonetemplate_soa_rname.py +30 -0
  92. netbox_dns/migrations/0014_alter_unique_constraints_lowercase.py +42 -0
  93. netbox_dns/migrations/0015_dnssec.py +168 -0
  94. netbox_dns/migrations/{0015_add_record_status.py → 0016_dnssec_policy_status.py} +5 -4
  95. netbox_dns/migrations/0017_dnssec_policy_zone_zone_template.py +41 -0
  96. netbox_dns/migrations/0018_zone_domain_status_zone_expiration_date.py +23 -0
  97. netbox_dns/migrations/0019_dnssecpolicy_parental_agents.py +25 -0
  98. netbox_dns/migrations/0020_netbox_3_4.py +1 -1
  99. netbox_dns/migrations/0020_remove_dnssecpolicy_parental_agents_and_more.py +29 -0
  100. netbox_dns/migrations/0021_alter_record_ptr_record.py +25 -0
  101. netbox_dns/migrations/0021_record_ip_address.py +1 -1
  102. netbox_dns/migrations/0022_alter_record_ipam_ip_address.py +26 -0
  103. netbox_dns/migrations/0023_disable_ptr_false.py +27 -0
  104. netbox_dns/migrations/0024_zonetemplate_parental_agents.py +25 -0
  105. netbox_dns/migrations/0025_remove_zone_inline_signing_and_more.py +22 -0
  106. netbox_dns/migrations/0026_alter_dnssecpolicy_nsec3_opt_out.py +18 -0
  107. netbox_dns/migrations/0026_domain_registration.py +1 -1
  108. netbox_dns/migrations/0027_zone_comments.py +18 -0
  109. netbox_dns/migrations/0028_alter_zone_default_ttl_alter_zone_soa_minimum_and_more.py +54 -0
  110. netbox_dns/migrations/0028_rfc2317_fields.py +44 -0
  111. netbox_dns/migrations/0029_alter_registrationcontact_street.py +18 -0
  112. netbox_dns/migrations/0029_record_fqdn.py +30 -0
  113. netbox_dns/mixins/__init__.py +1 -0
  114. netbox_dns/mixins/object_modification.py +57 -0
  115. netbox_dns/models/__init__.py +5 -1
  116. netbox_dns/models/dnssec_key_template.py +114 -0
  117. netbox_dns/models/dnssec_policy.py +203 -0
  118. netbox_dns/models/nameserver.py +61 -30
  119. netbox_dns/models/record.py +781 -234
  120. netbox_dns/models/record_template.py +198 -0
  121. netbox_dns/models/registrar.py +34 -15
  122. netbox_dns/models/{contact.py → registration_contact.py} +72 -43
  123. netbox_dns/models/view.py +129 -9
  124. netbox_dns/models/zone.py +806 -242
  125. netbox_dns/models/zone_template.py +209 -0
  126. netbox_dns/navigation.py +176 -76
  127. netbox_dns/signals/__init__.py +0 -0
  128. netbox_dns/signals/dnssec.py +32 -0
  129. netbox_dns/signals/ipam_dnssync.py +216 -0
  130. netbox_dns/tables/__init__.py +5 -1
  131. netbox_dns/tables/dnssec_key_template.py +49 -0
  132. netbox_dns/tables/dnssec_policy.py +140 -0
  133. netbox_dns/tables/ipam_dnssync.py +12 -0
  134. netbox_dns/tables/nameserver.py +14 -17
  135. netbox_dns/tables/record.py +117 -59
  136. netbox_dns/tables/record_template.py +91 -0
  137. netbox_dns/tables/registrar.py +20 -10
  138. netbox_dns/tables/{contact.py → registration_contact.py} +22 -11
  139. netbox_dns/tables/view.py +47 -3
  140. netbox_dns/tables/zone.py +62 -31
  141. netbox_dns/tables/zone_template.py +78 -0
  142. netbox_dns/template_content.py +124 -38
  143. netbox_dns/templates/netbox_dns/dnsseckeytemplate.html +70 -0
  144. netbox_dns/templates/netbox_dns/dnssecpolicy.html +163 -0
  145. netbox_dns/templates/netbox_dns/nameserver.html +31 -28
  146. netbox_dns/templates/netbox_dns/record/managed.html +2 -1
  147. netbox_dns/templates/netbox_dns/record/related.html +17 -6
  148. netbox_dns/templates/netbox_dns/record.html +140 -93
  149. netbox_dns/templates/netbox_dns/recordtemplate.html +96 -0
  150. netbox_dns/templates/netbox_dns/registrar.html +41 -34
  151. netbox_dns/templates/netbox_dns/registrationcontact.html +76 -0
  152. netbox_dns/templates/netbox_dns/view/button.html +10 -0
  153. netbox_dns/templates/netbox_dns/view/prefix.html +44 -0
  154. netbox_dns/templates/netbox_dns/view/related.html +33 -0
  155. netbox_dns/templates/netbox_dns/view.html +62 -18
  156. netbox_dns/templates/netbox_dns/zone/base.html +6 -3
  157. netbox_dns/templates/netbox_dns/zone/child.html +6 -5
  158. netbox_dns/templates/netbox_dns/zone/child_zone.html +18 -0
  159. netbox_dns/templates/netbox_dns/zone/delegation_record.html +18 -0
  160. netbox_dns/templates/netbox_dns/zone/managed_record.html +1 -1
  161. netbox_dns/templates/netbox_dns/zone/record.html +6 -5
  162. netbox_dns/templates/netbox_dns/zone/registration.html +43 -24
  163. netbox_dns/templates/netbox_dns/zone/rfc2317_child_zone.html +18 -0
  164. netbox_dns/templates/netbox_dns/zone.html +178 -119
  165. netbox_dns/templates/netbox_dns/zonetemplate/child.html +46 -0
  166. netbox_dns/templates/netbox_dns/zonetemplate.html +124 -0
  167. netbox_dns/templatetags/netbox_dns.py +10 -0
  168. netbox_dns/urls.py +50 -210
  169. netbox_dns/utilities/__init__.py +3 -0
  170. netbox_dns/{utilities.py → utilities/conversions.py} +55 -7
  171. netbox_dns/utilities/dns.py +11 -0
  172. netbox_dns/utilities/ipam_dnssync.py +370 -0
  173. netbox_dns/validators/__init__.py +4 -0
  174. netbox_dns/validators/dns_name.py +116 -0
  175. netbox_dns/validators/dns_value.py +147 -0
  176. netbox_dns/validators/dnssec.py +148 -0
  177. netbox_dns/validators/rfc2317.py +28 -0
  178. netbox_dns/views/__init__.py +5 -1
  179. netbox_dns/views/dnssec_key_template.py +78 -0
  180. netbox_dns/views/dnssec_policy.py +146 -0
  181. netbox_dns/views/nameserver.py +34 -15
  182. netbox_dns/views/record.py +156 -15
  183. netbox_dns/views/record_template.py +93 -0
  184. netbox_dns/views/registrar.py +32 -13
  185. netbox_dns/views/registration_contact.py +101 -0
  186. netbox_dns/views/view.py +58 -14
  187. netbox_dns/views/zone.py +130 -33
  188. netbox_dns/views/zone_template.py +82 -0
  189. netbox_plugin_dns-1.4.7.dist-info/METADATA +132 -0
  190. netbox_plugin_dns-1.4.7.dist-info/RECORD +201 -0
  191. {netbox_plugin_dns-0.21.4.dist-info → netbox_plugin_dns-1.4.7.dist-info}/WHEEL +2 -1
  192. {netbox_plugin_dns-0.21.4.dist-info → netbox_plugin_dns-1.4.7.dist-info/licenses}/LICENSE +2 -1
  193. netbox_plugin_dns-1.4.7.dist-info/top_level.txt +1 -0
  194. netbox_dns/filters/__init__.py +0 -6
  195. netbox_dns/filters/nameserver.py +0 -18
  196. netbox_dns/filters/record.py +0 -53
  197. netbox_dns/filters/view.py +0 -18
  198. netbox_dns/filters/zone.py +0 -112
  199. netbox_dns/forms/contact.py +0 -211
  200. netbox_dns/graphql/contact.py +0 -19
  201. netbox_dns/graphql/nameserver.py +0 -19
  202. netbox_dns/graphql/record.py +0 -19
  203. netbox_dns/graphql/registrar.py +0 -19
  204. netbox_dns/graphql/view.py +0 -19
  205. netbox_dns/graphql/zone.py +0 -19
  206. netbox_dns/management/commands/setup_coupling.py +0 -75
  207. netbox_dns/management/commands/update_soa.py +0 -22
  208. netbox_dns/middleware.py +0 -226
  209. netbox_dns/migrations/0001_initial.py +0 -115
  210. netbox_dns/migrations/0002_zone_default_ttl.py +0 -18
  211. netbox_dns/migrations/0003_soa_managed_records.py +0 -112
  212. netbox_dns/migrations/0004_create_ptr_for_a_aaaa_records.py +0 -80
  213. netbox_dns/migrations/0005_update_ns_records.py +0 -41
  214. netbox_dns/migrations/0006_zone_soa_serial_auto.py +0 -29
  215. netbox_dns/migrations/0007_alter_zone_soa_serial_auto.py +0 -17
  216. netbox_dns/migrations/0008_zone_status_names.py +0 -21
  217. netbox_dns/migrations/0009_netbox32.py +0 -71
  218. netbox_dns/migrations/0010_update_soa_records.py +0 -58
  219. netbox_dns/migrations/0011_add_view_model.py +0 -70
  220. netbox_dns/migrations/0012_adjust_zone_and_record.py +0 -17
  221. netbox_dns/migrations/0014_add_view_description.py +0 -16
  222. netbox_dns/migrations/0016_cleanup_ptr_records.py +0 -38
  223. netbox_dns/migrations/0017_alter_record_ttl.py +0 -17
  224. netbox_dns/migrations/0018_zone_arpa_network.py +0 -51
  225. netbox_dns/migrations/0019_update_ns_ttl.py +0 -19
  226. netbox_dns/templates/netbox_dns/contact.html +0 -71
  227. netbox_dns/templates/netbox_dns/related_dns_objects.html +0 -21
  228. netbox_dns/templatetags/view_helpers.py +0 -15
  229. netbox_dns/validators.py +0 -57
  230. netbox_dns/views/contact.py +0 -83
  231. netbox_plugin_dns-0.21.4.dist-info/METADATA +0 -101
  232. netbox_plugin_dns-0.21.4.dist-info/RECORD +0 -110
@@ -1,11 +1,15 @@
1
1
  import django_tables2 as tables
2
+ from django.utils.html import format_html
3
+ from django.utils.translation import gettext_lazy as _
4
+
2
5
 
3
6
  from netbox.tables import (
4
7
  NetBoxTable,
5
8
  ChoiceFieldColumn,
6
- ToggleColumn,
7
9
  TagColumn,
8
10
  ActionsColumn,
11
+ BooleanColumn,
12
+ TemplateColumn,
9
13
  )
10
14
  from tenancy.tables import TenancyColumnsMixin
11
15
 
@@ -13,27 +17,49 @@ from netbox_dns.models import Record
13
17
  from netbox_dns.utilities import value_to_unicode
14
18
 
15
19
 
20
+ __all__ = (
21
+ "RecordTable",
22
+ "ManagedRecordTable",
23
+ "RelatedRecordTable",
24
+ "DelegationRecordTable",
25
+ )
26
+
27
+
16
28
  class RecordBaseTable(TenancyColumnsMixin, NetBoxTable):
17
29
  zone = tables.Column(
30
+ verbose_name=_("Zone"),
31
+ linkify=True,
32
+ )
33
+ view = tables.Column(
34
+ verbose_name=_("View"),
35
+ accessor="zone__view",
18
36
  linkify=True,
19
37
  )
20
- type = tables.Column()
38
+ type = tables.Column(
39
+ verbose_name=_("Type"),
40
+ )
21
41
  name = tables.Column(
42
+ verbose_name=_("Name"),
22
43
  linkify=True,
23
44
  )
24
- value = tables.TemplateColumn(
45
+ fqdn = tables.Column(
46
+ verbose_name=_("FQDN"),
47
+ linkify=True,
48
+ )
49
+ value = TemplateColumn(
50
+ verbose_name=_("Value"),
25
51
  template_code="{{ value|truncatechars:64 }}",
26
52
  )
27
- unicode_value = tables.TemplateColumn(
28
- verbose_name="Unicode Value",
53
+ unicode_value = TemplateColumn(
54
+ verbose_name=_("Unicode Value"),
29
55
  template_code="{{ value|truncatechars:64 }}",
30
56
  accessor="value",
31
57
  )
32
58
  ttl = tables.Column(
33
- verbose_name="TTL",
59
+ verbose_name=_("TTL"),
34
60
  )
35
- active = tables.BooleanColumn(
36
- verbose_name="Active",
61
+ active = BooleanColumn(
62
+ verbose_name=_("Active"),
37
63
  )
38
64
 
39
65
  def render_name(self, value, record):
@@ -44,41 +70,17 @@ class RecordBaseTable(TenancyColumnsMixin, NetBoxTable):
44
70
 
45
71
 
46
72
  class RecordTable(RecordBaseTable):
47
- pk = ToggleColumn()
48
- status = ChoiceFieldColumn()
49
- disable_ptr = tables.BooleanColumn(
50
- verbose_name="Disable PTR",
51
- )
52
- tags = TagColumn(
53
- url_name="plugins:netbox_dns:record_list",
54
- )
55
- ptr_record = tables.Column(
56
- verbose_name="PTR Record",
57
- linkify=True,
58
- )
59
-
60
73
  class Meta(NetBoxTable.Meta):
61
74
  model = Record
75
+
62
76
  fields = (
63
- "pk",
64
- "zone",
65
- "name",
66
- "ttl",
67
- "type",
68
- "value",
69
- "unicode_value",
70
77
  "status",
71
- "disable_ptr",
72
- "ptr_record",
73
- "tags",
74
- "active",
75
78
  "description",
76
- "tenant",
77
- "tenant_group",
78
79
  )
80
+
79
81
  default_columns = (
80
- "zone",
81
82
  "name",
83
+ "zone",
82
84
  "ttl",
83
85
  "type",
84
86
  "value",
@@ -86,53 +88,109 @@ class RecordTable(RecordBaseTable):
86
88
  "active",
87
89
  )
88
90
 
89
-
90
- class ManagedRecordTable(RecordBaseTable):
91
- address_record = tables.Column(
92
- verbose_name="Address Record",
93
- linkify=True,
91
+ status = ChoiceFieldColumn(
92
+ verbose_name=_("Status"),
94
93
  )
95
- ipam_ip_address = tables.Column(
96
- verbose_name="IPAM IP Address",
94
+ disable_ptr = BooleanColumn(
95
+ verbose_name=_("Disable PTR"),
96
+ )
97
+ tags = TagColumn(
98
+ url_name="plugins:netbox_dns:record_list",
99
+ )
100
+ ptr_record = tables.Column(
101
+ verbose_name=_("PTR Record"),
97
102
  linkify=True,
98
103
  )
99
- actions = ActionsColumn(actions=("changelog",))
100
104
 
105
+
106
+ class ManagedRecordTable(RecordBaseTable):
101
107
  class Meta(NetBoxTable.Meta):
102
108
  model = Record
103
- fields = (
104
- "zone",
105
- "name",
106
- "ttl",
107
- "type",
108
- "value",
109
- "unicode_value",
110
- "address_record",
111
- "ipam_ip_address",
112
- "active",
113
- )
109
+
110
+ fields = ()
111
+
114
112
  default_columns = (
115
- "zone",
116
113
  "name",
114
+ "zone",
117
115
  "ttl",
118
116
  "type",
119
117
  "value",
120
118
  "active",
121
119
  )
122
120
 
121
+ address_records = tables.ManyToManyColumn(
122
+ verbose_name=_("Address Records"),
123
+ linkify=True,
124
+ linkify_item=True,
125
+ transform=lambda obj: (
126
+ obj.fqdn.rstrip(".")
127
+ if obj.zone.view.default_view
128
+ else f"[{obj.zone.view.name}] {obj.fqdn.rstrip('.')}"
129
+ ),
130
+ )
131
+ ipam_ip_address = tables.Column(
132
+ verbose_name=_("IPAM IP Address"),
133
+ linkify=True,
134
+ )
135
+ related_ip_address = tables.Column(
136
+ verbose_name=_("Related IP Address"),
137
+ empty_values=(),
138
+ orderable=False,
139
+ )
140
+ actions = ActionsColumn(actions=("changelog",))
123
141
 
124
- class RelatedRecordTable(RecordBaseTable):
125
- actions = ActionsColumn(actions=())
142
+ def render_related_ip_address(self, record):
143
+ if record.ipam_ip_address is not None:
144
+ address = record.ipam_ip_address
145
+ elif hasattr(record, "address_records"):
146
+ address_record = record.address_records.filter(
147
+ ipam_ip_address__isnull=False
148
+ ).first()
149
+ if address_record is not None:
150
+ address = address_record.ipam_ip_address
151
+ else:
152
+ address = None
153
+
154
+ if address is None:
155
+ return format_html("—")
156
+
157
+ return format_html(f"<a href='{address.get_absolute_url()}'>{address}</a>")
158
+
159
+ def value_related_ip_address(self, record):
160
+ if record.ipam_ip_address is not None:
161
+ return record.ipam_ip_address
162
+ elif hasattr(record, "address_records"):
163
+ address_record = record.address_records.filter(
164
+ ipam_ip_address__isnull=False
165
+ ).first()
166
+ if address_record is not None:
167
+ return address_record.ipam_ip_address
168
+
169
+ return None
126
170
 
171
+
172
+ class RelatedRecordTable(RecordBaseTable):
127
173
  class Meta(NetBoxTable.Meta):
128
174
  model = Record
129
- fields = (
175
+
176
+ fields = ()
177
+
178
+ default_columns = (
130
179
  "name",
131
180
  "zone",
132
181
  "type",
133
182
  "value",
134
- "unicode_value",
135
183
  )
184
+
185
+ actions = ActionsColumn(actions=())
186
+
187
+
188
+ class DelegationRecordTable(RecordBaseTable):
189
+ class Meta(NetBoxTable.Meta):
190
+ model = Record
191
+
192
+ fields = ()
193
+
136
194
  default_columns = (
137
195
  "name",
138
196
  "zone",
@@ -0,0 +1,91 @@
1
+ import django_tables2 as tables
2
+ from django.utils.translation import gettext_lazy as _
3
+
4
+ from netbox.tables import (
5
+ ActionsColumn,
6
+ BooleanColumn,
7
+ NetBoxTable,
8
+ TagColumn,
9
+ TemplateColumn,
10
+ )
11
+ from tenancy.tables import TenancyColumnsMixin
12
+
13
+ from netbox_dns.models import RecordTemplate
14
+ from netbox_dns.utilities import value_to_unicode
15
+
16
+
17
+ __all__ = (
18
+ "RecordTemplateTable",
19
+ "RecordTemplateDisplayTable",
20
+ )
21
+
22
+
23
+ class RecordTemplateTable(TenancyColumnsMixin, NetBoxTable):
24
+ class Meta(NetBoxTable.Meta):
25
+ model = RecordTemplate
26
+
27
+ fields = (
28
+ "status",
29
+ "description",
30
+ )
31
+
32
+ default_columns = (
33
+ "name",
34
+ "record_name",
35
+ "ttl",
36
+ "type",
37
+ "value",
38
+ "tags",
39
+ )
40
+
41
+ name = tables.Column(
42
+ verbose_name=_("Name"),
43
+ linkify=True,
44
+ )
45
+ record_name = tables.Column(
46
+ verbose_name=_("Record Name"),
47
+ )
48
+ type = tables.Column(
49
+ verbose_name=_("Type"),
50
+ )
51
+ value = TemplateColumn(
52
+ verbose_name=_("Value"),
53
+ template_code="{{ value|truncatechars:64 }}",
54
+ )
55
+ unicode_value = TemplateColumn(
56
+ verbose_name=_("Unicode Value"),
57
+ template_code="{{ value|truncatechars:64 }}",
58
+ accessor="value",
59
+ )
60
+ ttl = tables.Column(
61
+ verbose_name=_("TTL"),
62
+ )
63
+ disable_ptr = BooleanColumn(
64
+ verbose_name=_("Disable PTR"),
65
+ )
66
+ tags = TagColumn(
67
+ url_name="plugins:netbox_dns:recordtemplate_list",
68
+ )
69
+
70
+ def render_unicode_value(self, value):
71
+ return value_to_unicode(value)
72
+
73
+
74
+ class RecordTemplateDisplayTable(RecordTemplateTable):
75
+ class Meta(NetBoxTable.Meta):
76
+ model = RecordTemplate
77
+
78
+ fields = (
79
+ "status",
80
+ "description",
81
+ )
82
+
83
+ default_columns = (
84
+ "name",
85
+ "record_name",
86
+ "ttl",
87
+ "type",
88
+ "value",
89
+ )
90
+
91
+ actions = ActionsColumn(actions="")
@@ -1,27 +1,37 @@
1
1
  import django_tables2 as tables
2
+ from django.utils.translation import gettext_lazy as _
2
3
 
3
4
  from netbox.tables import NetBoxTable, TagColumn
4
5
 
5
6
  from netbox_dns.models import Registrar
6
7
 
7
8
 
8
- class RegistrarTable(NetBoxTable):
9
- name = tables.Column(
10
- linkify=True,
11
- )
12
- tags = TagColumn(
13
- url_name="plugins:netbox_dns:registrar_list",
14
- )
9
+ __all__ = ("RegistrarTable",)
10
+
15
11
 
12
+ class RegistrarTable(NetBoxTable):
16
13
  class Meta(NetBoxTable.Meta):
17
14
  model = Registrar
15
+
18
16
  fields = (
19
- "name",
17
+ "description",
20
18
  "iana_id",
21
19
  "referral_url",
22
20
  "whois_server",
23
21
  "abuse_email",
24
22
  "abuse_phone",
25
- "tags",
26
23
  )
27
- default_columns = ("name", "iana_id", "referral_url")
24
+
25
+ default_columns = (
26
+ "name",
27
+ "iana_id",
28
+ "referral_url",
29
+ )
30
+
31
+ name = tables.Column(
32
+ verbose_name=_("Name"),
33
+ linkify=True,
34
+ )
35
+ tags = TagColumn(
36
+ url_name="plugins:netbox_dns:registrar_list",
37
+ )
@@ -1,23 +1,21 @@
1
1
  import django_tables2 as tables
2
+ from django.utils.translation import gettext_lazy as _
2
3
 
3
4
  from netbox.tables import NetBoxTable, TagColumn
4
5
 
5
- from netbox_dns.models import Contact
6
+ from netbox_dns.models import RegistrationContact
6
7
 
7
8
 
8
- class ContactTable(NetBoxTable):
9
- contact_id = tables.Column(
10
- linkify=True,
11
- )
12
- tags = TagColumn(
13
- url_name="plugins:netbox_dns:contact_list",
14
- )
9
+ __all__ = ("RegistrationContactTable",)
15
10
 
11
+
12
+ class RegistrationContactTable(NetBoxTable):
16
13
  class Meta(NetBoxTable.Meta):
17
- model = Contact
14
+ model = RegistrationContact
15
+
18
16
  fields = (
19
- "contact_id",
20
17
  "name",
18
+ "description",
21
19
  "organization",
22
20
  "street",
23
21
  "city",
@@ -30,4 +28,17 @@ class ContactTable(NetBoxTable):
30
28
  "fax_ext",
31
29
  "email",
32
30
  )
33
- default_columns = ("contact_id", "name", "email")
31
+
32
+ default_columns = (
33
+ "contact_id",
34
+ "name",
35
+ "email",
36
+ )
37
+
38
+ contact_id = tables.Column(
39
+ verbose_name=_("Contact ID"),
40
+ linkify=True,
41
+ )
42
+ tags = TagColumn(
43
+ url_name="plugins:netbox_dns:registrationcontact_list",
44
+ )
netbox_dns/tables/view.py CHANGED
@@ -1,17 +1,61 @@
1
1
  import django_tables2 as tables
2
+ from django.utils.translation import gettext_lazy as _
2
3
 
3
- from netbox.tables import NetBoxTable
4
+ from netbox.tables import ActionsColumn, BooleanColumn, NetBoxTable, TagColumn
4
5
  from tenancy.tables import TenancyColumnsMixin
5
6
 
6
7
  from netbox_dns.models import View
7
8
 
8
9
 
10
+ __all__ = (
11
+ "ViewTable",
12
+ "RelatedViewTable",
13
+ )
14
+
15
+
9
16
  class ViewTable(TenancyColumnsMixin, NetBoxTable):
17
+ class Meta(NetBoxTable.Meta):
18
+ model = View
19
+
20
+ fields = (
21
+ "description",
22
+ "ip_address_filter",
23
+ )
24
+
25
+ default_columns = (
26
+ "name",
27
+ "default_view",
28
+ )
29
+
10
30
  name = tables.Column(
31
+ verbose_name=_("Name"),
11
32
  linkify=True,
12
33
  )
34
+ default_view = BooleanColumn(
35
+ verbose_name=_("Default View"),
36
+ )
37
+ tags = TagColumn(url_name="plugins:netbox_dns:view_list")
13
38
 
39
+
40
+ class RelatedViewTable(TenancyColumnsMixin, NetBoxTable):
14
41
  class Meta(NetBoxTable.Meta):
15
42
  model = View
16
- fields = ("name", "description", "tenant", "tenant_group")
17
- default_columns = ("name",)
43
+
44
+ fields = (
45
+ "name",
46
+ "description",
47
+ "tenant",
48
+ "tenant_group",
49
+ "tags",
50
+ )
51
+
52
+ default_columns = (
53
+ "name",
54
+ "description",
55
+ )
56
+
57
+ name = tables.Column(
58
+ linkify=True,
59
+ )
60
+ tags = TagColumn(url_name="plugins:netbox_dns:view_list")
61
+ actions = ActionsColumn(actions=())
netbox_dns/tables/zone.py CHANGED
@@ -1,78 +1,109 @@
1
1
  import django_tables2 as tables
2
+ from django.utils.translation import gettext_lazy as _
2
3
 
3
4
  from netbox.tables import (
4
5
  ChoiceFieldColumn,
5
6
  NetBoxTable,
6
7
  TagColumn,
7
8
  ActionsColumn,
9
+ columns,
8
10
  )
9
11
  from tenancy.tables import TenancyColumnsMixin
10
12
 
11
13
  from netbox_dns.models import Zone
12
14
 
13
15
 
16
+ __all__ = (
17
+ "ZoneTable",
18
+ "ZoneDisplayTable",
19
+ )
20
+
21
+
14
22
  class ZoneTable(TenancyColumnsMixin, NetBoxTable):
23
+ class Meta(NetBoxTable.Meta):
24
+ model = Zone
25
+
26
+ fields = (
27
+ "description",
28
+ "soa_rname",
29
+ "soa_serial",
30
+ "rfc2317_parent_managed",
31
+ "registry_domain_id",
32
+ "expiration_date",
33
+ "domain_status",
34
+ "comments",
35
+ )
36
+
37
+ default_columns = (
38
+ "name",
39
+ "view",
40
+ "status",
41
+ "tags",
42
+ )
43
+
15
44
  name = tables.Column(
45
+ verbose_name=_("Name"),
16
46
  linkify=True,
17
47
  )
18
48
  view = tables.Column(
49
+ verbose_name=_("View"),
19
50
  linkify=True,
20
51
  )
21
52
  soa_mname = tables.Column(
53
+ verbose_name=_("SOA MName"),
22
54
  linkify=True,
23
55
  )
24
- status = ChoiceFieldColumn()
56
+ status = ChoiceFieldColumn(
57
+ verbose_name=_("Status"),
58
+ )
25
59
  tags = TagColumn(
26
60
  url_name="plugins:netbox_dns:zone_list",
27
61
  )
28
62
  default_ttl = tables.Column(
29
- verbose_name="Default TTL",
63
+ verbose_name=_("Default TTL"),
64
+ )
65
+ dnssec_policy = tables.Column(
66
+ verbose_name=_("DNSSEC Policy"),
67
+ linkify=True,
68
+ )
69
+ rfc2317_prefix = tables.Column(
70
+ verbose_name=_("RFC2317 Prefix"),
71
+ )
72
+ rfc2317_parent_zone = tables.Column(
73
+ verbose_name=_("RFC2317 Parent Zone"),
74
+ linkify=True,
30
75
  )
31
76
  registrar = tables.Column(
77
+ verbose_name=_("Registrar"),
32
78
  linkify=True,
33
79
  )
80
+ domain_status = ChoiceFieldColumn(
81
+ verbose_name=_("Domain Status"),
82
+ )
34
83
  registrant = tables.Column(
84
+ verbose_name=_("Registrant"),
35
85
  linkify=True,
36
86
  )
37
87
  admin_c = tables.Column(
88
+ verbose_name=_("Administrative Contact"),
38
89
  linkify=True,
39
90
  )
40
91
  tech_c = tables.Column(
92
+ verbose_name=_("Technical Contact"),
41
93
  linkify=True,
42
94
  )
43
95
  billing_c = tables.Column(
96
+ verbose_name=_("Billing Contact"),
44
97
  linkify=True,
45
98
  )
99
+ comments = columns.MarkdownColumn()
46
100
 
47
101
  def render_name(self, value, record):
48
102
  return record.display_name
49
103
 
50
- class Meta(NetBoxTable.Meta):
51
- model = Zone
52
- fields = (
53
- "pk",
54
- "name",
55
- "view",
56
- "status",
57
- "description",
58
- "tags",
59
- "default_ttl",
60
- "soa_mname",
61
- "soa_rname",
62
- "soa_serial",
63
- "registrar",
64
- "registry_domain_id",
65
- "registrant",
66
- "admin_c",
67
- "tech_c",
68
- "billing_c",
69
- "tenant",
70
- "tenant_group",
71
- )
72
- default_columns = (
73
- "pk",
74
- "name",
75
- "view",
76
- "status",
77
- "tags",
78
- )
104
+
105
+ class ZoneDisplayTable(ZoneTable):
106
+ class Meta(ZoneTable.Meta):
107
+ pass
108
+
109
+ actions = ActionsColumn(actions=("changelog",))