Answer the question
In order to leave comments, you need to log in
How to display first and last name in django-allauth?
Good afternoon, I registered through the social network on my site, everything works fine, but I can’t display the first and last name in the template, I use
{% load account %}
{% user_display user %}
in the template, when entering the site, it shows either user or id866..., but you need to display Vasya Pupkin
Answer the question
In order to leave comments, you need to log in
Write your own function to display the username and write the path to it in settings.py .
ACCOUNT_USER_DISPLAY (=a callable returning user.username)
A callable (or string of the form 'some.module.callable_name') that takes a user as its only argument and returns the display name of the user. The default implementation returns user.username.
ACCOUNT_USER_DISPLAY = lambda user: u'%s %s' % (user.first_name, user.last_name)
orACCOUNT_USER_DISPLAY = lambda user: user.get_full_name()
orACCOUNT_USER_DISPLAY = 'myapp.somemodule.utils.user_display'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question