Opened 7 months ago

Closed 7 months ago

#33684 closed New feature (duplicate)

Create a default 'users' app when using startproject

Reported by: Vlad C Owned by: nobody
Component: Core (Management commands) Version: 4.0
Severity: Normal Keywords: custom user AUTH_USER_MODEL startproject
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Feature request to tackle this issue: https://docs.djangoproject.com/en/4.0/ref/settings/#std:setting-AUTH_USER_MODEL

Warning

You cannot change the AUTH_USER_MODEL setting during the lifetime of a project (i.e. once you have made and migrated models that depend on it) without serious effort. It is intended to be set at the project start, and the model it refers to must be available in the first migration of the app that it lives in. See Substituting a custom User model for more details.

This is a big issue for developers that don't realize you must create a custom user before the first migration.

Solution:

When first starting a project using

$ django-admin startproject mysite

Django should also by default create an app named 'users' that contains a ready-made User model in project_folder -> users -> models.py which could then be customized there if needed.
And obviously add these default settings to Django AUTH_USER_MODEL = 'users.User' and INSTALLED_APPS = [ 'users' ... ]

Change History (1)

comment:1 Changed 7 months ago by Tim Graham

Component: contrib.authCore (Management commands)
Resolution: duplicate
Status: newclosed

Duplicate of #27909.

Note: See TracTickets for help on using tickets.
Back to Top