Rearchitect the logic for registering models & model features #9195

Closed
opened 2025-12-29 20:46:49 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Feb 5, 2024).

Originally assigned to: @jeremystretch on GitHub.

Proposed Changes

Currently, NetBox automatically registers all models and their features by hooking into Django's class_prepared signal. This issue proposes moving the registration triggers into the ready() method of the AppConfig class for each app.

Justification

Although the current approach has generally worked well, issues arose while introducing a custom user model under #12795. Because Django must load the (now custom) user model before the signal handler, we must reorder the logic. This will also enable cleaner separation of functions.

Originally created by @jeremystretch on GitHub (Feb 5, 2024). Originally assigned to: @jeremystretch on GitHub. ### Proposed Changes Currently, NetBox automatically registers all models and their features by hooking into Django's [`class_prepared`](https://docs.djangoproject.com/en/5.0/ref/signals/#class-prepared) signal. This issue proposes moving the registration triggers into the `ready()` method of the AppConfig class for each app. ### Justification Although the current approach has generally worked well, issues arose while introducing a custom user model under #12795. Because Django must load the (now custom) user model before the signal handler, we must reorder the logic. This will also enable cleaner separation of functions.
adam added the status: acceptedtype: housekeeping labels 2025-12-29 20:46:49 +01:00
adam closed this issue 2025-12-29 20:46:49 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9195