Skip to content

Commit f57c725

Browse files
authored
🚚 release (#138)
2 parents 0ead9cb + 97bf9ae commit f57c725

File tree

7 files changed

+67
-4
lines changed

7 files changed

+67
-4
lines changed

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ at [https://netboxlabs.com/blog/introducing-diode-streamlining-data-ingestion-in
2020
| >= 4.2.3 | 1.1.0 |
2121
| >= 4.2.3 | 1.2.0 |
2222
| >= 4.4.0 | 1.4.0 |
23+
| >= 4.4.0 | 1.4.1 |
2324

2425
## Installation
2526

‎docker/Dockerfile-diode-netbox-plugin‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM netboxcommunity/netbox:v4.3.3-3.3.0
1+
FROM netboxcommunity/netbox:v4.4.2-3.4.1
22

33
COPY ./netbox/configuration/ /etc/netbox/config/
44
RUN chmod 755 /etc/netbox/config/* && \

‎docker/docker-compose.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: diode-netbox-plugin
22
services:
33
netbox: &netbox
4-
image: netboxcommunity/netbox:v4.3.3-3.3.0-diode-netbox-plugin
4+
image: netboxcommunity/netbox:v4.4.2-3.4.1-diode-netbox-plugin
55
build:
66
context: .
77
dockerfile: Dockerfile-diode-netbox-plugin

‎docker/requirements-diode-netbox-plugin.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ coverage==7.6.0
44
grpcio==1.62.1
55
protobuf==5.29.5
66
pytest==8.0.2
7-
netboxlabs-netbox-branching==0.6.0
7+
netboxlabs-netbox-branching==0.7.1

‎netbox_diode_plugin/api/matcher.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,11 @@ def _prepare_data(self, data: dict) -> dict:
449449
field = self.model_class._meta.get_field(field_name)
450450
# special handling for object type -> content type id
451451
if field.is_relation and hasattr(field, "related_model") and field.related_model == ContentType:
452-
prepared[field_name] = content_type_id(value)
452+
# Handle ManyToMany fields (list of object types) and ForeignKey fields (single object type)
453+
if isinstance(value, list):
454+
prepared[field_name] = [content_type_id(v) for v in value]
455+
else:
456+
prepared[field_name] = content_type_id(value)
453457
else:
454458
prepared[field_name] = value
455459

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env python
2+
# Copyright 2025 NetBox Labs, Inc.
3+
"""Diode NetBox Plugin - Database migrations."""
4+
5+
from django.db import migrations, models
6+
7+
import netbox_diode_plugin.models
8+
9+
10+
class Migration(migrations.Migration):
11+
"""Create ClientCredentials model and alter Setting.diode_target field."""
12+
13+
dependencies = [
14+
("netbox_diode_plugin", "0001_squashed_0005"),
15+
]
16+
17+
operations = [
18+
migrations.CreateModel(
19+
name="ClientCredentials",
20+
fields=[
21+
(
22+
"id",
23+
models.BigAutoField(
24+
auto_created=True, primary_key=True, serialize=False
25+
),
26+
),
27+
],
28+
options={
29+
"permissions": (
30+
("view_clientcredentials", "Can view Client Credentials"),
31+
(
32+
"add_clientcredentials",
33+
"Can perform actions on Client Credentials",
34+
),
35+
),
36+
"managed": False,
37+
"default_permissions": (),
38+
},
39+
),
40+
migrations.AlterField(
41+
model_name="setting",
42+
name="diode_target",
43+
field=models.CharField(
44+
max_length=255,
45+
validators=[netbox_diode_plugin.models.diode_target_validator],
46+
),
47+
),
48+
]

‎netbox_diode_plugin/models.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,19 @@ def get_absolute_url(self):
4141
return reverse("plugins:netbox_diode_plugin:settings")
4242

4343

44+
class UnmanagedModelManager(models.Manager):
45+
"""Manager for unmanaged models that prevents database queries."""
46+
47+
def get_queryset(self):
48+
"""Return an empty queryset without hitting the database."""
49+
return super().get_queryset().none()
50+
51+
4452
class ClientCredentials(models.Model):
4553
"""Dummy model to allow for permissions, saved filters, etc.."""
4654

55+
objects = UnmanagedModelManager()
56+
4757
class Meta:
4858
"""Meta class."""
4959

0 commit comments

Comments
 (0)