Skip to content

Commit

Permalink
'can_access_moderation_panel' filter tag added
Browse files Browse the repository at this point in the history
  • Loading branch information
ellmetha committed Mar 31, 2015
1 parent b6a62d6 commit 7e0ce51
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions machina/templatetags/forum_moderation_tags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-

# Standard library imports
from __future__ import unicode_literals

# Third party imports
from django import template

# Local application / specific library imports
from machina.core.loading import get_class

PermissionHandler = get_class('forum_permission.handler', 'PermissionHandler')
perm_handler = PermissionHandler()

register = template.Library()


@register.filter
def can_access_moderation_panel(user):
"""
This will return a boolean indicating if the passed user can access
the forum moderation panel.
Usage::
{% if user|can_access_moderation_panel %}...{% endif %}
"""
return perm_handler.can_access_moderation_panel(user)

0 comments on commit 7e0ce51

Please sign in to comment.