Skip to content

Commit 914cf3c

Browse files
committed
Merge branch 'develop' into default-branch
2 parents b4e43c7 + 97bf9ae commit 914cf3c

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
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

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
@@ -84,9 +84,19 @@ def branch_schema_id(self):
8484
return branch.schema_id if branch else None
8585

8686

87+
class UnmanagedModelManager(models.Manager):
88+
"""Manager for unmanaged models that prevents database queries."""
89+
90+
def get_queryset(self):
91+
"""Return an empty queryset without hitting the database."""
92+
return super().get_queryset().none()
93+
94+
8795
class ClientCredentials(models.Model):
8896
"""Dummy model to allow for permissions, saved filters, etc.."""
8997

98+
objects = UnmanagedModelManager()
99+
90100
class Meta:
91101
"""Meta class."""
92102

0 commit comments

Comments
 (0)