I've been working with a custom user model in my latest project and when I tried to pull in the InstanceSelectorPanel into one of my models.py files, I got this error:
File ".../venv/lib/python3.8/site-packages/instance_selector/registry.py", line 15, in <module>
User = get_user_model()
File ".../venv/lib/python3.8/site-packages/django/contrib/auth/__init__.py", line 161, in get_user_model
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'accounts.User' that has not been installed
I'm fairly certain this is because I am defined AUTH_USER_MODEL in my base.py as 'accounts.User'.
For context, I followed the instructions here when moving to my custom user model.
According to this, the problem is most likely in registry.py:
Note that get_user_model() cannot be called at the module level in any models.py file (and by extension any file that a models.py imports), since you'll end up with a circular import. Generally, it's easier to keep calls to get_user_model() inside a method whenever possible (so it's called at run time rather than load time), and use settings.AUTH_USER_MODEL in all other cases.
I'll submit a PR shortly with what I believe is the proper fix.
I've been working with a custom user model in my latest project and when I tried to pull in the
InstanceSelectorPanel
into one of mymodels.py
files, I got this error:I'm fairly certain this is because I am defined
AUTH_USER_MODEL
in mybase.py
as'accounts.User'
.For context, I followed the instructions here when moving to my custom user model.
According to this, the problem is most likely in
registry.py
:I'll submit a PR shortly with what I believe is the proper fix.