Opened 17 months ago

Closed 3 months 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: master
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 Changed 17 months ago by Sławek Ehlert

Owner: changed from nobody to Sławek Ehlert

comment:2 Changed 17 months ago by Markus Holtermann

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

comment:3 Changed 12 months ago by DoHyun Kim

Owner: changed from Sławek Ehlert to DoHyun Kim

comment:4 Changed 7 months ago by Tim Graham

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

PR (needs some improvements)

comment:5 Changed 3 months ago by Tim Graham <timograham@…>

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