#5338 closed (wontfix)
User __unicode__ return value of get_full_name()
| Reported by: | 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)
Change History (8)
by , 18 years ago
| Attachment: | user-unicode.diff added |
|---|
comment:1 by , 18 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → 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 by , 18 years ago
| Resolution: | wontfix |
|---|---|
| Status: | closed → reopened |
What if we changed the __unicode__() method to display the username IF the first_name or last_name fields aren't specified?
comment:4 by , 18 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | reopened → 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 by , 18 years ago
What about forms? This is a big issue with ModelChoiceFields since you can't change the __unicode__() method.
comment:6 by , 16 years ago
Just for anyone stumbling on this ticket: http://www.djangosnippets.org/snippets/1642/
diff file for user model change