enhance User.__str__ with get_full_name

This commit is contained in:
Martin Pépin 2017-05-23 16:50:43 +01:00
parent 3c8f1c58c5
commit 74135f8877

View file

@ -211,9 +211,7 @@ class UserProfileAdmin(UserAdmin):
# FIXME: This is absolutely horrible.
def user_str(self):
if self.first_name and self.last_name:
return "{} {} ({})".format(
self.first_name, self.last_name, self.username
)
return "{} ({})".format(self.get_full_name(), self.username)
else:
return self.username
User.__str__ = user_str