Opened 17 years ago

Closed 17 years ago

Last modified 15 years ago

#5338 closed (wontfix)

User __unicode__ return value of get_full_name()

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

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@… 17 years ago.
diff file for user model change
user-unicode-2.diff (541 bytes ) - added by Seth Buntin <seth@…> 17 years ago.
Patch for second suggestion

Download all attachments as: .zip

Change History (8)

by seth@…, 17 years ago

Attachment: user-unicode.diff added

diff file for user model change

comment:1 by James Bennett, 17 years ago

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 by Seth Buntin <seth@…>, 17 years ago

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 by Seth Buntin <seth@…>, 17 years ago

Has patch: set

Patch for above

by Seth Buntin <seth@…>, 17 years ago

Attachment: user-unicode-2.diff added

Patch for second suggestion

comment:4 by Russell Keith-Magee, 17 years ago

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 by anonymous, 17 years ago

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

comment:6 by Chris Beaven, 15 years ago

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

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