Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#5338 closed (wontfix)

User __unicode__ return value of get_full_name()

Reported by: seth@… Owned by: Adrian Holovaty
Component: Contrib apps Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

This isn't that big of a deal but I would love it if the unicode method of the User model returned the get_full_name() instead of the uesrname.

Attachments (2)

user-unicode.diff (569 bytes) - added by seth@… 9 years ago.
diff file for user model change
user-unicode-2.diff (541 bytes) - added by Seth Buntin <seth@…> 9 years ago.
Patch for second suggestion

Download all attachments as: .zip

Change History (8)

Changed 9 years ago by seth@…

Attachment: user-unicode.diff added

diff file for user model change

comment:1 Changed 9 years ago by James Bennett

Resolution: wontfix
Status: newclosed

This isn't feasible; first_name and last_name are both optional fields, which would leave you with users whoss __unicode__() simply returned an empty string. The username field is required, however (and unique), which means that it will always give you something.

comment:2 Changed 9 years ago by Seth Buntin <seth@…>

Resolution: wontfix
Status: closedreopened

What if we changed the __unicode__() method to display the username IF the first_name or last_name fields aren't specified?

comment:3 Changed 9 years ago by Seth Buntin <seth@…>

Has patch: set

Patch for above

Changed 9 years ago by Seth Buntin <seth@…>

Attachment: user-unicode-2.diff added

Patch for second suggestion

comment:4 Changed 9 years ago by Russell Keith-Magee

Resolution: wontfix
Status: reopenedclosed

This new suggestion would result in unpredictable behaviour. It also doesn't address the fact that it would be a backwards incompatible change for something that is entirely cosmetic. If you need the full name in a template, you can use {{ user.get_full_name }}.

comment:5 Changed 9 years ago by anonymous

What about forms? This is a big issue with ModelChoiceFields since you can't change the __unicode__() method.

comment:6 Changed 7 years ago by Chris Beaven

Just for anyone stumbling on this ticket: http://www.djangosnippets.org/snippets/1642/

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