Opened 8 years ago

Closed 8 years ago

#8140 closed (fixed)

User.objects.create_superuser should return the new User instance

Reported by: Dan Fairs Owned by: Gary Wilson
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 Eric Holscher 8 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 8 years ago by Dan Fairs

Component: AuthenticationContrib apps
Needs documentation: unset
Needs tests: unset
Owner: set to nobody
Patch needs improvement: unset

comment:2 Changed 8 years ago by Eric Holscher

Has patch: set
milestone: post-1.0
Owner: changed from nobody to Eric Holscher
Status: newassigned

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

comment:3 Changed 8 years ago by Eric Holscher

Triage Stage: UnreviewedAccepted

comment:4 Changed 8 years ago by Evgeny Sizikov

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 8 years ago by siddhi

Cc: siddhartag@… added

comment:6 Changed 8 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

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

Cc: zerok@… added

Changed 8 years ago by Eric Holscher

Attachment: superuser.diff added

comment:8 Changed 8 years ago by Eric Holscher

Triage Stage: AcceptedReady for checkin

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

comment:9 Changed 8 years ago by Gary Wilson

Owner: changed from Eric Holscher to Gary Wilson
Status: assignednew

comment:10 Changed 8 years ago by Gary Wilson

Status: newassigned

comment:11 Changed 8 years ago by Gary Wilson

Resolution: fixed
Status: assignedclosed

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

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