Crash admin interface after creating a user

Hi there,
I am having a black screen with not find after trying to add a new user profile to the user_app.
The config has only this app and the model as a OneToOne relationship with the built-in user model
picture of the existing ERD from django and details of the screen and the sequence that leads to this error.

no error message in the console.
Not sure what to do next
Thanks.

Side note: Please don’t post images of code or text here. (The screenshots of the admin pages are fine.) When you need to post code, templates, error messages, etc, copy/paste the text into the body of your post, between lines of three backtick - ` characters. This means you’ll have a line of ```, then the code (etc), then another line of ```.

It’s not clear to me what the sequence of events is.

What page are you looking at before the problem? (This is in the admin?)

What do you click on that page?

If you’re using the admin, what is your ModelAdmin class for your Profile Model?

Well noted thanks.
It is a subclass, just registered the model with n admin.py
The error occurs when I click on save button to submit all the inputs of the form of my user profile.
Does that answer the question?

Your screen shots show the add user page, but I don’t see an image for the add profile page.

when i try to create a user profile, the first field is a drop down list with the existing username and then you have the plus button to create a new user, I click on this one and the pop up for new user is showing up
(The sequence start here) I fill the new username pwd save and then I have this black screen.
Just this screen and No error message in the console.
Is there anyway to increase the verbose?

Please post your settings.py file. There’s something configured wrong here.

It looks like you’re clicking on an “Add Profile” button, but it’s bringing up the “Add User” page. That shouldn’t be happening. (They’re two different models.)

Also, your ERD does not match your code.

About the ERD I am surprised because I used GraphViz to generate the diagram just after the migration of the profile model.

from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-5d(d(2=jhn-$&o=6b8ukk2qatki$n38uh4bsrm*cucnqqx!++('

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []

GRAPH_MODELS = {
  'all_applications': True,
  'group_models': True,
}

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django_extensions',
    'user_app'
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'CORE.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'CORE.wsgi.application'


# Database
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}


AUTH_USER_MODEL = 'user_app.Profile'

# Password validation
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/5.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.0/howto/static-files/

STATIC_URL = 'static/'

# Default primary key field type
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

So you’re replacing the default user with your Profile model. But you have a OneToOneRelationship with User but are not creating an instance of User.

This is what is causing the problem.

Based on your ERD, you do not want that OneToOneField, you want to define your Profile as inheriting from AbstractUser.

Edit: You might want to review the docs for Model inheritance to get a deeper understanding of how inheritance works with Django models.