netbox-plugin-dns 1.1.0b4__py3-none-any.whl → 1.1.0b5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of netbox-plugin-dns might be problematic. Click here for more details.

netbox_dns/__init__.py CHANGED
@@ -5,7 +5,7 @@ from ipam.choices import IPAddressStatusChoices
5
5
 
6
6
  from netbox_dns.choices import RecordTypeChoices
7
7
 
8
- __version__ = "1.1.0b4"
8
+ __version__ = "1.1.0b5"
9
9
 
10
10
 
11
11
  class DNSConfig(PluginConfig):
netbox_dns/api/views.py CHANGED
@@ -4,6 +4,7 @@ from rest_framework.response import Response
4
4
  from rest_framework.routers import APIRootView
5
5
 
6
6
  from ipam.models import Prefix
7
+ from ipam.filtersets import PrefixFilterSet
7
8
 
8
9
  from netbox.api.viewsets import NetBoxModelViewSet
9
10
 
@@ -160,3 +161,4 @@ class RecordTemplateViewSet(NetBoxModelViewSet):
160
161
  class PrefixViewSet(NetBoxModelViewSet):
161
162
  queryset = Prefix.objects.all()
162
163
  serializer_class = PrefixSerializer
164
+ filterset_class = PrefixFilterSet
netbox_dns/fields/ipam.py CHANGED
@@ -6,9 +6,6 @@ __all__ = ("PrefixDynamicModelMultipleChoiceField",)
6
6
 
7
7
 
8
8
  class PrefixDynamicModelMultipleChoiceField(DynamicModelMultipleChoiceField):
9
- def __init__(self, *args, **kwargs):
10
- super().__init__(*args, **kwargs)
11
-
12
9
  widget = APISelectMultiple(api_url="/api/plugins/netbox-dns/prefixes")
13
10
 
14
11
  def label_from_instance(self, obj):
@@ -1,4 +1,7 @@
1
1
  import django_tables2 as tables
2
+ from django_tables2.utils import Accessor
3
+ from django.utils.html import format_html
4
+
2
5
 
3
6
  from netbox.tables import (
4
7
  NetBoxTable,
@@ -6,11 +9,16 @@ from netbox.tables import (
6
9
  TagColumn,
7
10
  ActionsColumn,
8
11
  )
12
+ from ipam.lookups import Host, Inet
9
13
  from tenancy.tables import TenancyColumnsMixin
10
14
 
11
15
  from netbox_dns.models import Record
12
16
  from netbox_dns.utilities import value_to_unicode
13
17
 
18
+ import logging
19
+
20
+ logger = logging.getLogger("netbox_dns")
21
+
14
22
 
15
23
  __all__ = (
16
24
  "RecordTable",
@@ -100,6 +108,11 @@ class ManagedRecordTable(RecordBaseTable):
100
108
  verbose_name="IPAM IP Address",
101
109
  linkify=True,
102
110
  )
111
+ related_ip_address = tables.Column(
112
+ verbose_name="Related IP Address",
113
+ empty_values=(),
114
+ orderable=False,
115
+ )
103
116
  actions = ActionsColumn(actions=("changelog",))
104
117
 
105
118
  class Meta(NetBoxTable.Meta):
@@ -113,6 +126,7 @@ class ManagedRecordTable(RecordBaseTable):
113
126
  "unicode_value",
114
127
  "address_record",
115
128
  "ipam_ip_address",
129
+ "related_ip_address",
116
130
  "active",
117
131
  )
118
132
  default_columns = (
@@ -124,6 +138,28 @@ class ManagedRecordTable(RecordBaseTable):
124
138
  "active",
125
139
  )
126
140
 
141
+ def render_related_ip_address(self, record):
142
+ if record.ipam_ip_address is not None:
143
+ address = record.ipam_ip_address
144
+ elif (
145
+ hasattr(record, "address_record")
146
+ and record.address_record.ipam_ip_address is not None
147
+ ):
148
+ address = record.address_record.ipam_ip_address
149
+ else:
150
+ return format_html("—")
151
+
152
+ return format_html(f"<a href='{address.get_absolute_url()}'>{address}</a>")
153
+
154
+ def value_related_ip_address(self, record):
155
+ if record.ipam_ip_address is not None:
156
+ return record.ipam_ip_address
157
+ elif (
158
+ hasattr(record, "address_record")
159
+ and record.address_record.ipam_ip_address is not None
160
+ ):
161
+ return record.address_record.ipam_ip_address
162
+
127
163
 
128
164
  class RelatedRecordTable(RecordBaseTable):
129
165
  actions = ActionsColumn(actions=())
@@ -1,6 +1,10 @@
1
1
  from dns import name as dns_name
2
2
 
3
+ from django.db.models import F, Q, Case, When, OuterRef, Subquery
4
+
3
5
  from netbox.views import generic
6
+ from ipam.fields import IPAddressField
7
+ from ipam.models import IPAddress
4
8
 
5
9
  from netbox_dns.filtersets import RecordFilterSet
6
10
  from netbox_dns.forms import (
@@ -37,9 +41,7 @@ class RecordListView(generic.ObjectListView):
37
41
 
38
42
 
39
43
  class ManagedRecordListView(generic.ObjectListView):
40
- queryset = Record.objects.filter(managed=True).prefetch_related(
41
- "zone", "address_record"
42
- )
44
+ queryset = Record.objects.prefetch_related("ipam_ip_address", "address_record")
43
45
  filterset = RecordFilterSet
44
46
  filterset_form = RecordFilterForm
45
47
  table = ManagedRecordTable
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: netbox-plugin-dns
3
- Version: 1.1.0b4
3
+ Version: 1.1.0b5
4
4
  Summary: NetBox DNS is a NetBox plugin for managing DNS data.
5
5
  Home-page: https://github.com/peteeckel/netbox-plugin-dns
6
6
  License: MIT
@@ -1,4 +1,4 @@
1
- netbox_dns/__init__.py,sha256=o6LleCsdMgaES4LaRbzvKSTH7jBS01AoIZNiKwxv97Y,1880
1
+ netbox_dns/__init__.py,sha256=27jTa_Vkm837fJbzvwAxS3hYrI6ZzPDeczbquH4PEfg,1880
2
2
  netbox_dns/api/nested_serializers.py,sha256=-ZhAiyf-8UHlkcBomBp1J7ci1dSwrxWRbbfskD-D_yQ,3172
3
3
  netbox_dns/api/serializers.py,sha256=u-kQurUftGkUGAMh-VkMgXPebLYeZq9WDz9uKzkk2No,370
4
4
  netbox_dns/api/serializers_/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -12,14 +12,14 @@ netbox_dns/api/serializers_/view.py,sha256=u5HqZtPzGCBTFCsH5GkPGsyG-oR4WIJ8XOqdW
12
12
  netbox_dns/api/serializers_/zone.py,sha256=ZOCNHNufPK8T9UKKjT4NcIyfb1zwG7gD6TpPTlMHi0k,4862
13
13
  netbox_dns/api/serializers_/zone_template.py,sha256=usx0vRsqRqHP6sqB92fQy3VTjIfjYflULTtQhQksSpk,3709
14
14
  netbox_dns/api/urls.py,sha256=f77mwzenQ54WMZeLRLKBmPZMKmfXhagREe7LAuSjAsM,802
15
- netbox_dns/api/views.py,sha256=lCK_Z1sImxGc-ClfEsZzh-HoksaLAb6fBgb6dj9lk8o,4805
15
+ netbox_dns/api/views.py,sha256=kr_cXu-4sL6VaXzJqSJN0ajqetvuHrpdb0GONtTijkM,4887
16
16
  netbox_dns/apps.py,sha256=JCW5eS-AQBUubDJve1DjP-IRFKTFGQh1NLGWzJpC5MI,151
17
17
  netbox_dns/choices/__init__.py,sha256=jOVs2VGV5SVADRlqVnrFeAy26i8BIeEAbGpiX7K8bL8,42
18
18
  netbox_dns/choices/record.py,sha256=IYW_g1ZvuNX2ZlRLOkurcrdfWgcXNpi2gQzRfX5C0lY,1113
19
19
  netbox_dns/choices/zone.py,sha256=u0zt03gTkeo_und0VxaTTCh3GIFv6UxtUIhoe3VJ00A,472
20
20
  netbox_dns/fields/__init__.py,sha256=U1nbFIwwtvr10pp3Sk91jEZeWkVQBSJtr0BVWYgOfiA,89
21
21
  netbox_dns/fields/address.py,sha256=DJwc-z5Lg6US85gNIB_Chx7ahs1GYNswdhaXkLiK3jA,1554
22
- netbox_dns/fields/ipam.py,sha256=nj3nNMU4ebo3Ung0M7uhOBLlKUGDPIVTv1lJJ82HcLU,565
22
+ netbox_dns/fields/ipam.py,sha256=wla-kBm77BpD0LNQhgRZS1RYbVois7WDqPpyQkUT02k,481
23
23
  netbox_dns/fields/network.py,sha256=FgKEm5DAe_4D7Fubtj8B4SwfU3-Z9KV7kDIzRNpBBnQ,3682
24
24
  netbox_dns/fields/rfc2317.py,sha256=24qNNLbI-SGlsKqGaLNaVk8EHFrju65YTET3O-8XgTc,2571
25
25
  netbox_dns/filtersets/__init__.py,sha256=zvHYWy23FFmK4vxLpoMo-OD5OQBtcTUV_HG-5LCtvQE,197
@@ -85,7 +85,7 @@ netbox_dns/tables/__init__.py,sha256=s41w4o77tIwmhnLjsOsg08R9m3wrlomkkfCLTVQuPzc
85
85
  netbox_dns/tables/contact.py,sha256=sPs7d1ZhVC5dOS37dPYFqebNd7WGvsV_eYzX_TMcbzY,804
86
86
  netbox_dns/tables/ipam_dnssync.py,sha256=7gxf6nXn2zgpnpCr5E5qebXv7QCzrgIqfSzyka53USU,272
87
87
  netbox_dns/tables/nameserver.py,sha256=fFiE-yH-_GyRDaV4SVw094r6uH58Kx56NSWDGaMR58g,764
88
- netbox_dns/tables/record.py,sha256=0Yg0qwZ8Vjz6pkZnmof4ZK1Hsvk9DNEzmJwoIwJZJFQ,3189
88
+ netbox_dns/tables/record.py,sha256=X2DZVeQtgSdXaHWS1G9SI7ue462CVV6PJd6EoUXXNsQ,4355
89
89
  netbox_dns/tables/record_template.py,sha256=16Lu-WDjs2m9Uxx6WkURL39NlyJ8lWzj5Kl6C6lz3E8,2159
90
90
  netbox_dns/tables/registrar.py,sha256=M-ckyQUs6dqjTCPf7bAr6UuLEA-q9f9CxKW7yp3rGoM,680
91
91
  netbox_dns/tables/view.py,sha256=jf2S4TiOdMq6-wWk0ndR1uBJpkOx_f3pqAuM1nSXTBo,1178
@@ -131,13 +131,13 @@ netbox_dns/validators/rfc2317.py,sha256=ivylEiNKlmX2x41rwqDrFkD5CFf9FtpNEfsKHX_p
131
131
  netbox_dns/views/__init__.py,sha256=s41w4o77tIwmhnLjsOsg08R9m3wrlomkkfCLTVQuPzc,196
132
132
  netbox_dns/views/contact.py,sha256=qM9F6MQBvO8ERR7quGLdQ5kW4roNLJ61As8m0qQTapg,2471
133
133
  netbox_dns/views/nameserver.py,sha256=DFr0eybMshc1FW06g4cy9Nk4VRMxRqakI5KtHFiAVRc,3286
134
- netbox_dns/views/record.py,sha256=Qv-Yf9CxlHz9C9-8hy-_WVbRL5f6opXUHJD4SsDcVGo,4587
134
+ netbox_dns/views/record.py,sha256=xebtE5XoYyGpp_8O6lywLtU0oXjrrtipnCLePgtNCO0,4703
135
135
  netbox_dns/views/record_template.py,sha256=BkemTBEramLhYqB6HrA80sNgtduW1ZOJwbYs3i7srik,2510
136
136
  netbox_dns/views/registrar.py,sha256=yRQgFm3vgBD21ZQex9asjs0QWegvSHlcyHXLnjvc5xs,2324
137
137
  netbox_dns/views/view.py,sha256=iXBJTc3JD5cD5z0RTcHVTtYV-KNIJGneeoxymXChdUE,2759
138
138
  netbox_dns/views/zone.py,sha256=SKhf_WHcFVpKqFTuUMf-Dmxu1AwFHBeo_DtD8UGFrJ8,5483
139
139
  netbox_dns/views/zone_template.py,sha256=qvXl-bpc1fMc1WFngynj4-Q3-JJDgKdT-r54s4M1D0s,2118
140
- netbox_plugin_dns-1.1.0b4.dist-info/LICENSE,sha256=I3tDu11bZfhFm3EkV4zOD5TmWgLjnUNLEFwrdjniZYs,1112
141
- netbox_plugin_dns-1.1.0b4.dist-info/METADATA,sha256=ktOXrD3WonLsUqWDbTg_n8w_ItTFfW7NB_60nuMcnwY,6406
142
- netbox_plugin_dns-1.1.0b4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
143
- netbox_plugin_dns-1.1.0b4.dist-info/RECORD,,
140
+ netbox_plugin_dns-1.1.0b5.dist-info/LICENSE,sha256=I3tDu11bZfhFm3EkV4zOD5TmWgLjnUNLEFwrdjniZYs,1112
141
+ netbox_plugin_dns-1.1.0b5.dist-info/METADATA,sha256=XOk6Bjyn0rVCul1V3LeGfCcnGVH5E1O7T5EeGg_abWQ,6406
142
+ netbox_plugin_dns-1.1.0b5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
143
+ netbox_plugin_dns-1.1.0b5.dist-info/RECORD,,