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

17419 fix MPTT issue with migrations for nested module bays #17553

Merged
merged 4 commits into from
Sep 26, 2024

Conversation

arthanson
Copy link
Collaborator

@arthanson arthanson commented Sep 19, 2024

Fixes: #17419

Note in the migration had to use the actual model and not apps.get_model as the manager for rebuild is needed.

@arthanson arthanson changed the title 17419 mptt module bay DRAFT: 17419 fix mptt module bay Sep 19, 2024
@arthanson arthanson changed the title DRAFT: 17419 fix mptt module bay 17419 fix mptt module bay Sep 20, 2024
@arthanson arthanson marked this pull request as ready for review September 20, 2024 17:03
@arthanson arthanson changed the title 17419 fix mptt module bay 17419 fix MPTT issue with migrations for nested module bays Sep 23, 2024
Copy link
Member

@jeremystretch jeremystretch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure it's safe to import the model directly within a migration? IIRC, in the past we've had to jump through some hoops to avoid it.

@bctiemann
Copy link
Contributor

Oh right, good point, the usual pattern is to do like EventRule = apps.get_model("extras", "EventRule"), because otherwise the model state can't be guaranteed in a later code state. I should have caught that

@jeremystretch jeremystretch merged commit 0ec632e into develop Sep 26, 2024
6 checks passed
@jeremystretch jeremystretch deleted the 17419-mptt-module-bay branch September 26, 2024 19:24
bctiemann pushed a commit that referenced this pull request Oct 11, 2024
* 17419 rebuild module bay tree on upgrade

* 17419 rebuild module bay tree on upgrade

* 17419 use get_model
jeremystretch pushed a commit to alehaa/netbox that referenced this pull request Oct 11, 2024
…ommunity#17553)

* 17419 rebuild module bay tree on upgrade

* 17419 rebuild module bay tree on upgrade

* 17419 use get_model
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MPTT issues with using nested modules on pre v4.1 data
3 participants