Fix AttributeError on rack and device pages

NetBox 4.7 lists related objects via Model.objects.restrict(), which the
plain FloorPlanItem manager lacked. Drop the reverse accessors from rack
and device (related_name='+') and use a RestrictedQuerySet manager.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
MrBlakeandClaude Opus 5.5 committed 2026-11-04 13:23:02 +01:00
1 parent 04a6e16975
commit 25e944ada7
6 files changed
+39 -7

No files matched your search

@@ -0,0 +1,27 @@
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dcim', '__first__'),
('netbox_floorplanner', '0002_floorplan_tenant'),
]
operations = [
migrations.AlterField(
model_name='floorplanitem',
name='rack',
field=models.ForeignKey(
blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='dcim.rack',
),
),
migrations.AlterField(
model_name='floorplanitem',
name='device',
field=models.ForeignKey(
blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='dcim.device',
),
),
]