Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rearchitect the logic for registering models & model features #15042

Closed
jeremystretch opened this issue Feb 5, 2024 · 0 comments
Closed

Rearchitect the logic for registering models & model features #15042

jeremystretch opened this issue Feb 5, 2024 · 0 comments
Assignees
Labels
status: accepted This issue has been accepted for implementation type: housekeeping Changes to the application which do not directly impact the end user
Milestone

Comments

@jeremystretch
Copy link
Member

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.

@jeremystretch jeremystretch added type: housekeeping Changes to the application which do not directly impact the end user status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Feb 5, 2024
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Feb 8, 2024
@jeremystretch jeremystretch self-assigned this Feb 8, 2024
@jeremystretch jeremystretch added this to the v4.0 milestone Feb 8, 2024
jeremystretch added a commit that referenced this issue Feb 21, 2024
* Closes #15042: Move model registration logic to AppConfigs

* Refactor register_model() to accept multiple models
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: housekeeping Changes to the application which do not directly impact the end user
Projects
None yet
Development

No branches or pull requests

1 participant