mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-25 17:33:08 +01:00
is_helpdesk_staff template filter (applied in navigation.html)
This commit is contained in:
parent
4ed8f11754
commit
8be4480a3f
@ -1,4 +1,4 @@
|
||||
{% load i18n %}{% load url from future %}
|
||||
{% load i18n helpdesk_staff %}{% load url from future %}
|
||||
|
||||
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
|
||||
<div class="navbar-header">
|
||||
@ -11,7 +11,7 @@
|
||||
</div>
|
||||
|
||||
<div class="collapse navbar-collapse" id="helpdesk-nav-collapse">
|
||||
{% if helpdesk_settings.HELPDESK_NAVIGATION_ENABLED and user.is_authenticated or user.is_staff %}
|
||||
{% if helpdesk_settings.HELPDESK_NAVIGATION_ENABLED and user.is_authenticated or user|is_helpdesk_staff %}
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href='{% url 'helpdesk_dashboard' %}'><span class="glyphicon glyphicon-dashboard"></span> <span class="nav-text">{% trans "Dashboard" %}</span></a></li>
|
||||
<li><a href='{% url 'helpdesk_list' %}'><span class="glyphicon glyphicon-tags"></span> <span class="nav-text">{% trans "Tickets" %}</span></a></li>
|
||||
|
22
helpdesk/templatetags/helpdesk_staff.py
Normal file
22
helpdesk/templatetags/helpdesk_staff.py
Normal file
@ -0,0 +1,22 @@
|
||||
"""
|
||||
django-helpdesk - A Django powered ticket tracker for small enterprise.
|
||||
|
||||
templatetags/helpdesk_staff.py - The is_helpdesk_staff template filter returns True if the user qualifies as Helpdesk staff.
|
||||
"""
|
||||
import logging
|
||||
from django.template import Library
|
||||
from django.db.models import Q
|
||||
|
||||
from helpdesk.decorators import is_helpdesk_staff
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
register = Library()
|
||||
|
||||
|
||||
@register.filter(name='is_helpdesk_staff')
|
||||
def helpdesk_staff(user):
|
||||
try:
|
||||
return is_helpdesk_staff(user)
|
||||
except Exception, e:
|
||||
logger.exception("'helpdesk_staff' template tag (django-helpdesk) crashed")
|
Loading…
Reference in New Issue
Block a user