Development #9864
Make names of a full name start with a letter in upper case.
Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Catégorie:
-
Version cible:
-
Début:
03 février 2016
Echéance:
% réalisé:
0%
Temps estimé:
Patch proposed:
Non
Planning:
Description
In some cases, names of a fullname are not in camel case.
This is ugly when we display it.
We may make this change in get_fullname():
diff --git a/src/authentic2/custom_user/models.py b/src/authentic2/custom_user/models.py index bdd872c..fb2f2f9 100644 --- a/src/authentic2/custom_user/models.py +++ b/src/authentic2/custom_user/models.py @@ -65,7 +65,7 @@ class User(AbstractBaseUser, PermissionMixin): Returns the first_name plus the last_name, with a space in between. """ full_name = '%s %s' % (self.first_name, self.last_name) - return full_name.strip() or self.username or self.email + return full_name.strip().title() or self.username or self.email def get_short_name(self): "Returns the short name for the user."
That could affect some SAML SP since the edupersontargetedid of SAML assertions is built on get_username() that may call get_fullname().
Or we could change it in templates :
diff --git a/src/authentic2/templates/authentic2/base.html b/src/authentic2/templates/authentic2/base.html index 36193c9..ba12dc1 100644 --- a/src/authentic2/templates/authentic2/base.html +++ b/src/authentic2/templates/authentic2/base.html @@ -22,7 +22,7 @@ {% block user-links %} <ul class="user-info"> {% if user.is_authenticated %} - <li class="ui-name" title="{% blocktrans %}Last login {{ LAST_LOGIN }}{% endblocktrans %}">{{ user.get_full_name }}</li> + <li class="ui-name" title="{% blocktrans %}Last login {{ LAST_LOGIN }}{% endblocktrans %}">{{ user.get_full_name|title }}</li> <li class="ui-logout"><a href="{% block logout-url %}{% url 'auth_logout' %}{% endblock %}">{% trans "Logout" %}</a></li> {% endif %} </ul>
Historique
Mis à jour par Frédéric Péters il y a environ 8 ans
This won't work, it will for example capitalize "Charles de Gaulle" as "Charles De Gaulle", or "bell hooks" as "Bell Hooks" As a rule of thumb: names can be anything, they should never be altered.
Mis à jour par Benjamin Dauvergne il y a environ 8 ans
Frederic is right1, the source must be improved, if capitalization is wrong in the directory then the directory must be updated.
[1]: http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/
Mis à jour par Mikaël Ates il y a environ 8 ans
- Statut changé de Nouveau à Fermé
Ok. So we can close.