Opened 8 years ago

Closed 8 years ago

Last modified 6 years ago

#5338 closed (wontfix)

User __unicode__ return value of get_full_name()

Reported by: seth@… Owned by: adrian
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:


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

Download all attachments as: .zip

Change History (8)

Changed 8 years ago by seth@…

diff file for user model change

comment:1 Changed 8 years ago by ubernostrum

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

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

  • Resolution wontfix deleted
  • Status changed from closed to reopened

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

  • Has patch set

Patch for above

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

Patch for second suggestion

comment:4 Changed 8 years ago by russellm

  • Resolution set to wontfix
  • Status changed from reopened to closed

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 7 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 6 years ago by SmileyChris

Just for anyone stumbling on this ticket:

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