Opened 8 years ago

Closed 6 years ago

#28044 closed Cleanup/optimization (fixed)

Different logic in createsuperuser command between interactive and non-interactive mode

Reported by: Sławek Ehlert Owned by: DoHyun Kim
Component: contrib.auth Version: dev
Severity: Normal Keywords: createsuperuser management command
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Currently the createsuperuser management command logic differs when running in non-interactive mode (--no-input option) and in interactive mode (the default).

Here's a summary of what it does currently.

In interactive mode:

  • checks if stdin is a TTY (obviously),
  • checks if provided user already exists (before creating it),
  • provides "fake_user_data" for the case where User model has FKs to other models,
  • validates provided password.

In non-interactive mode:

  • cleans every required field and a USERNAME_FIELD (fix for interactive mode is already in #28016),
  • doesn't allow to provide password (there's #27801 for this case - I already did some work on that ticket).

I think it would be good to combine the logic for both modes before tackling #27801. That would also make #28016 obsolete.

Change History (5)

comment:1 by Sławek Ehlert, 8 years ago

Owner: changed from nobody to Sławek Ehlert

comment:2 by Markus Holtermann, 8 years ago

Needs documentation: set
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

comment:3 by DoHyun Kim, 7 years ago

Owner: changed from Sławek Ehlert to DoHyun Kim

comment:4 by Tim Graham, 7 years ago

Has patch: set
Needs documentation: unset
Patch needs improvement: set

PR (needs some improvements)

comment:5 by Tim Graham <timograham@…>, 6 years ago

Resolution: fixed
Status: assignedclosed

In f1f4aeb2:

Fixed #28044 -- Unified the logic for createsuperuser's interactive and --noinput modes.

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