fix: Delay importing models.CMSPlugin in utils. #637
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Continuation of PR #636
As mentioned in #468, Importing
html.clean_html
too early prevents registering custom user models containing anHTMLField
.This solves the issue by decoupling the import of
models.CMSPlugin
into the relevant function calls, to allow registering the models properly.NOTE: This lacks a proper test, as I couldn't manage to register a custom user model and define it in
settings.AUTH_USER_MODEL
using django-cms's app_helper mechanism. If you absolutely need a test, can you please provide guidance on how to define a custom user model, that would trigger the error (when 172e1f0348415fa80ce4b622c34587460e162afd is not present)?