-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
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
Fixed #35545, Refs #32833 -- Fixed ContentTypeManager.get_for_models() crash in CreateModel migrations. #18294
Conversation
@csirmazbendeguz does this work for you? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this is the right approach as it will allow models that are not registered in the registry associated with the ContentType
model to have content types created for them.
Maybe that's a sign of a larger issue in the original patch?
opts_models = needed_opts.pop( | ||
ct._meta.apps.get_model(ct.app_label, ct.model)._meta, [] | ||
) | ||
opts_models = needed_opts.pop((ct.app_label, ct.model), []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this is the crux of the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this is the crux of it 👍
Which patch are you referring to here? 🙂 |
@sarahboyce , your branch is working for me |
The one that introduced the regression #18105 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this is the right approach as it will allow models that are not registered in the registry associated with the ContentType model to have content types created for them.
It appears that get_for_model
already has this peculiarity which explains why the code was working before #18105 was merged and switched to get_for_models
.
Since it makes get_for_models
more coherent with the canonical get_for_model
I think this is fine.
…) crash in CreateModel migrations. Thank you to Csirmaz Bendegúz for the report and Simon Charettes for the review.
Trac ticket number
ticket-35545
Branch description
Provide a concise overview of the issue or rationale behind the proposed changes.
Checklist
main
branch.