'Print users' data inside a template in Django
I'm new to Django and I'm trying to print users' information such as email, first name, username in a template that should work as "My Profile Page".
For some reason, the only thing I'm able to print is the username of the logged-in user with {{request.user.username}} and the id (both {{request.user.id}} and {{user.id}} work)
Users are registered using the UserCreationForm
If I try to print the email with {{request.user.email}} or {{user.email}} nothing is shown.
My settings.py is the default one
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR / 'templates']
,
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
