Add warning about reserved names for scripts #5999

Closed
opened 2025-12-29 19:35:34 +01:00 by adam · 1 comment
Owner

Originally created by @hagbarddenstore on GitHub (Jan 25, 2022).

Change Type

Addition

Area

Functionality/features

Proposed Changes

The custom scripts documentation should mention that a script can't be named the same as one of the built-in applications since it might clash in quite odd ways.

Example, if you name your script circuits.py and work on models in the circuits application, whenever you try to save one of those models, you'll get an error An exception occurred: SerializerNotFound: Could not determine serializer for circuits.Circuit with prefix ''.

The fix is to rename the script to something other than circuits.py.

Originally created by @hagbarddenstore on GitHub (Jan 25, 2022). ### Change Type Addition ### Area Functionality/features ### Proposed Changes The custom scripts documentation should mention that a script can't be named the same as one of the built-in applications since it might clash in quite odd ways. Example, if you name your script `circuits.py` and work on models in the `circuits` application, whenever you try to save one of those models, you'll get an error `An exception occurred: SerializerNotFound: Could not determine serializer for circuits.Circuit with prefix ''`. The fix is to rename the script to something other than `circuits.py`.
adam added the type: documentation label 2025-12-29 19:35:34 +01:00
adam closed this issue 2025-12-29 19:35:35 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jan 25, 2022):

The custom scripts documentation should mention that a script can't be named the same as one of the built-in applications since it might clash in quite odd ways.

This is nothing unique to NetBox: Such is the case with any Python module. (For example, you also cannot name your script django.) I appreciate the suggestions, however keeping our documentation limited in scope is crucial to their long-term maintainability, so I'm going to decline.

@jeremystretch commented on GitHub (Jan 25, 2022): > The custom scripts documentation should mention that a script can't be named the same as one of the built-in applications since it might clash in quite odd ways. This is nothing unique to NetBox: Such is the case with _any_ Python module. (For example, you also cannot name your script `django`.) I appreciate the suggestions, however keeping our documentation limited in scope is crucial to their long-term maintainability, so I'm going to decline.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5999