Opened 6 months ago

Last modified 6 weeks ago

#28044 assigned Cleanup/optimization

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: no Needs documentation: yes
Needs tests: no Patch needs improvement: no
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 (3)

comment:1 Changed 6 months ago by Sławek Ehlert

Owner: changed from nobody to Sławek Ehlert

comment:2 Changed 6 months ago by Markus Holtermann

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

comment:3 Changed 6 weeks ago by DoHyun Kim

Owner: changed from Sławek Ehlert to DoHyun Kim
Note: See TracTickets for help on using tickets.
Back to Top