Discussion:
Best way to show/hide the logout link in a template?
Andre Lopes
2011-08-18 21:27:41 UTC
Permalink
Hi,

I am new to Django... I have made a logout link, but now I am in doubt
on which the best way to show/hide this template tag:

[code]
<a href="{% url auth_logout_next 'directorio' %}">Logout</a>
[/code]

Which is the best way of show/hide this link?

Sorry if it is a basic question.


Best Regards,
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Kev Dwyer
2011-08-18 21:45:41 UTC
Permalink
Post by Andre Lopes
Hi,
I am new to Django... I have made a logout link, but now I am in doubt
[code]
<a href="{% url auth_logout_next 'directorio' %}">Logout</a>
[/code]
Which is the best way of show/hide this link?
Sorry if it is a basic question.
Best Regards,
I use

{% if user.is_authenticated %}

to condition my logout link's appearance.

See https://docs.djangoproject.com/en/1.3/topics/auth/#authentication-data-
in-templates

Cheers,

Kev
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Andre Lopes
2011-08-18 22:04:46 UTC
Permalink
Thanks Kev,

It was exactly what I needed.

Regards,
Post by Kev Dwyer
Post by Andre Lopes
Hi,
I am new to Django... I have made a logout link, but now I am in doubt
[code]
<a href="{% url auth_logout_next 'directorio' %}">Logout</a>
[/code]
Which is the best way of show/hide this link?
Sorry if it is a basic question.
Best Regards,
I use
{% if user.is_authenticated %}
to condition my logout link's appearance.
See https://docs.djangoproject.com/en/1.3/topics/auth/#authentication-data-
in-templates
Cheers,
Kev
--
You received this message because you are subscribed to the Google Groups "Django users" group.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Loading...