I am unable to specify a custom AUTH_USER_MODEL
if that model is in a nested application.
Here is some project structure:
├── project
│ ├── settings.py
│ ├── my_parent_app
│ │ ├── __init__.py
│ │ ├── apps.py
│ │ └── my_child_app
│ │ ├── __init__.py
│ │ ├── apps.py
│ │ └── models.py
and here is some code:
project/my_parent_app/my_child_app/models.py:
from django.contrib.auth.models import AbstractUser
from django.db import models
class User(AbstractUser):
is_a_nice_user = models.BooleanField(default=False)
project/settings.py:
INSTALLED_APPS = [
'my_parent_app',
'my_parent_app.my_child_app',
]
AUTH_USER_MODEL = 'my_parent_app.my_child_app.User'
When I try to do anything, I get this error:
ValueError: Invalid model reference 'my_parent_app.my_child_app.User'. String model references must be of the form 'app_label.ModelName'.
This is a very similar to this question. But how can I solve this without resorting to making my_child_app
a separate top-level app?