9👍
✅
Depending on your view it might be as simple as:
{% if request.user.is_staff %}
<li><a href="{% url dashboard %}">{% trans 'Dashboard' %}</a></li>
{% endif %}
👤arie
7👍
It’s as simple as:
{# The following link should be displayed just to staff members #}
{% if request.user.is_staff %}
<li><a href="{% url dashboard %}">{% trans 'Dashboard' %}</a></li>
{% endif %}
where user
is the relevant user model, depending if you use Django’s vanilla User or you have overriding it.
- [Django]-Intermittent ImportError with Django package
- [Django]-Is it possible to run ubuntu terminal commands using DJango
- [Django]-How to properly show image stored from a remote file server to a django HTML template?
- [Django]-Why I am Getting '_SIGCHLDWaker' object has no attribute 'doWrite' in Scrapy?
Source:stackexchange.com