Shall be Model names unique? #11510
Replies: 3 comments 3 replies
-
For reference, here's what I have on my home system (which has been migrated through many version of Netbox over about 4 years):
So I don't know where your sites.site came from. (Could it have been a plugin?)
I think it's a good point. Maybe filter_scope should take (app_name, model_name) or |
Beta Was this translation helpful? Give feedback.
-
We had django.contrib.sites in INSTALLED_APPS. That's how it appeared in django_content_type table. Anyway app_name have to be specified here: netbox/netbox/ipam/filtersets.py Line 781 in d7c37d9 I'll try to raise an issue for it. |
Beta Was this translation helpful? Give feedback.
-
As mentioned in the aforementioned issue, adding django.contrib.sites into INSTALLED_APPS is not supported and really is the source of your problem here. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Our migrated database from 2.10 to 3.3 still has present content type for Site model in sites app. We do not know how long this resides in the db. From id it seems that Site model was initially defined under dcim app, then moved to site app and now it's back under dcim app.
We found out this as a problem when using VLANGroupFilterSet
netbox/netbox/ipam/filtersets.py
Line 742 in d7c37d9
Crash line:
netbox/netbox/ipam/filtersets.py
Line 781 in d7c37d9
MultipleObjectsReturned at /api/ipam/vlan-groups/ get() returned more than one ContentType -- it returned 2!
Problem was resolved by removing row id 75 from django_content_type table.
BUT the general question - shall be all Netbox and Netbox plugin model object names unique?
In case of VLANGroupFilterSet this applies to model names: region, sitegroup, site, location, rack, clustergroup, cluster
When uniqueness of mentioned model names is not required then the reported behavior might be a potential bug.
Beta Was this translation helpful? Give feedback.
All reactions