I've got a custom user model in my project, but it appears to be the case that if I attempt to use a HTMLField within it (for example, if I want a 'biography' field), it causes a LookupError because utils.py imports cms.models.CMSPlugin which eventually tries to get the custom user model which doesn't exist yet.
Here's a simple model which should reproduce the error:
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
from djangocms_text_ckeditor.fields import HTMLField
class Individual(AbstractBaseUser, PermissionsMixin):
biography = HTMLField(
'professional biography',
blank=True,
null=True,
)
and here's the relevant part of the traceback:
File "redacted/apps/individuals/models.py", line 4, in <module>
from djangocms_text_ckeditor.fields import HTMLField
File ".venv/lib/python3.6/site-packages/djangocms_text_ckeditor/fields.py", line 7, in <module>
from .html import clean_html
File ".venv/lib/python3.6/site-packages/djangocms_text_ckeditor/html.py", line 14, in <module>
from .utils import plugin_to_tag
File ".venv/lib/python3.6/site-packages/djangocms_text_ckeditor/utils.py", line 8, in <module>
from cms.models import CMSPlugin
File ".venv/lib/python3.6/site-packages/cms/models/__init__.py", line 4, in <module>
from .permissionmodels import * # nopyflakes
File ".venv/lib/python3.6/site-packages/cms/models/permissionmodels.py", line 21, in <module>
User = apps.get_registered_model(user_app_name, user_model_name)
File ".venv/lib/python3.6/site-packages/django/apps/registry.py", line 268, in get_registered_model
"Model '%s.%s' not registered." % (app_label, model_name))
LookupError: Model 'individuals.Individual' not registered.
The order of apps in my INSTALLED_APPS is:
[
'redacted.apps.individuals',
'cms',
'djangocms_text_ckeditor',
]
I've got a custom user model in my project, but it appears to be the case that if I attempt to use a
HTMLFieldwithin it (for example, if I want a 'biography' field), it causes a LookupError becauseutils.pyimportscms.models.CMSPluginwhich eventually tries to get the custom user model which doesn't exist yet.Here's a simple model which should reproduce the error:
and here's the relevant part of the traceback:
The order of apps in my
INSTALLED_APPSis: