Django login, exit URL and current username

I am new to Django and have just started working with django-registration. Can someone tell me how to get the login name, logout name and current user name in my template. Are these template tags? There is an exhaustive list for all the default variables shipped with Django.

I lost it a bit. For a while I searched Google but found nothing.

Thank.

+5
source share
1 answer

Make sure you have "django.contrib.auth.middleware.AuthenticationMiddleware" in settings.MIDDLEWARE_CLASSES

In the template:

{{ request.user.username }}

Login and logout URLs can be found in the settings:

  • settings.LOGIN_URL (default = / accounts / login)
  • settings.LOGOUT_URL ( =/ / )

url

{% url your.login.view.name%}

..

+12

All Articles