django-schema-graph
django-schema-graph copied to clipboard
Cannot add item: item with id x/y already exists
When using oscar-stores, I get:
Error: Cannot add item: item with id stores/OpeningPeriod already exists
at i.value (main.js:59)
at i.value (main.js:59)
at new i (main.js:59)
at l (main.js:59)
at a.mounted (main.js:59)
at Yt (main.js:7)
at Qi (main.js:7)
at Object.insert (main.js:7)
at S (main.js:7)
at _e.__patch__ (main.js:7)
Vt @ main.js:7
Note that it fails to show anything when that happens. Disabling that app in the graph would be a better result - esp. if it is mentioned in the sidebar as disabled.
And after disabling stores, which I am not using anyway, it works for django-oscar, and a few other medium sized apps! It looks great, but it is very hard to find a model.
A little curious, the console log shows some unnecessary precision
Stabilization progress 50%
main.js:59 Stabilization progress 55.00000000000001%
main.js:59 Stabilization progress 60%
I have encountered this issue myself now, so I know the cause. I have a local branch that reproduces the error, but I suspect the solution will not be straightforward. I'll push that branch when I get a chance, and will look into what I can do to address this.
EDIT: I should have said the cause...
If two model classes have the same name in the same app, then we'll hit this error.
I encountered this when a superclass was defined outside of the models file, and had the same name as the concrete model subclass.