| 1 |
Template Tags |
| 2 |
============= |
| 3 |
|
| 4 |
Use ``user_display`` to render a user name without making assumptions on |
| 5 |
how the user is represented (e.g. render the username, or first |
| 6 |
name?):: |
| 7 |
|
| 8 |
{% load account %} |
| 9 |
|
| 10 |
{% user_display user %} |
| 11 |
|
| 12 |
Or, if you need to use in a ``{% blocktrans %}``:: |
| 13 |
|
| 14 |
{% load account %} |
| 15 |
|
| 16 |
{% user_display user as user_display %} |
| 17 |
{% blocktrans %}{{ user_display }} has logged in...{% endblocktrans %} |
| 18 |
|
| 19 |
Then, override the ``ACCOUNT_USER_DISPLAY`` setting with your project |
| 20 |
specific user display callable. |
| 21 |
|
| 22 |
If you set ``ACCOUNT_USERNAME_REQUIRED = False`` and ``ACCOUNT_USER_MODEL_USERNAME_FIELD = None``, |
| 23 |
then you can simply display the user.email with {{ user }}:: |
| 24 |
|
| 25 |
In case you forgot, your username is {{ user }}. |