Code

Opened 6 years ago

Closed 5 years ago

#8140 closed (fixed)

User.objects.create_superuser should return the new User instance

Reported by: danfairs Owned by: gwilson
Component: Contrib apps Version: master
Severity: Keywords:
Cc: siddhartag@…, zerok@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

There's a small inconsistency in django.contrib.admin.models.UserManager: create_user() returns the user object that has just been created, but create_superuser() doesn't. It would lead to shorter code (probably mostly in tests) if create_superuser() returned the user object too.

This is the case as of svn r8223.

Attachments (1)

superuser.diff (648 bytes) - added by ericholscher 5 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 6 years ago by danfairs

  • Component changed from Authentication to Contrib apps
  • Needs documentation unset
  • Needs tests unset
  • Owner set to nobody
  • Patch needs improvement unset

comment:2 Changed 6 years ago by ericholscher

  • Has patch set
  • milestone set to post-1.0
  • Owner changed from nobody to ericholscher
  • Status changed from new to assigned

Added patch, set for post 1.0 because you can work around it, but for consistency it does make sense.

comment:3 Changed 6 years ago by ericholscher

  • Triage Stage changed from Unreviewed to Accepted

comment:4 Changed 6 years ago by esizikov

I would vote for including this upstream before 1.0 release, too. it doesn't seems like returning a newly created user instance could broke anything...

comment:5 Changed 6 years ago by siddhi

  • Cc siddhartag@… added

comment:6 Changed 5 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

comment:7 Changed 5 years ago by Horst Gutmann <zerok@…>

  • Cc zerok@… added

Changed 5 years ago by ericholscher

comment:8 Changed 5 years ago by ericholscher

  • Triage Stage changed from Accepted to Ready for checkin

[16:18] <jacobkm> ericholscher: once you learn how to spell "u", go ahead and mark it rfc.

comment:9 Changed 5 years ago by gwilson

  • Owner changed from ericholscher to gwilson
  • Status changed from assigned to new

comment:10 Changed 5 years ago by gwilson

  • Status changed from new to assigned

comment:11 Changed 5 years ago by gwilson

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [10217]) Fixed #8140 -- Made UserManager.create_superuser return the new User object, based on patch from ericholscher.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.