:py:mod:`oioioi.base.templatetags.check_perm` ============================================= .. py:module:: oioioi.base.templatetags.check_perm Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: oioioi.base.templatetags.check_perm.CheckPermNode Functions ~~~~~~~~~ .. autoapisummary:: oioioi.base.templatetags.check_perm.check_perm Attributes ~~~~~~~~~~ .. autoapisummary:: oioioi.base.templatetags.check_perm.register .. py:data:: register .. py:class:: CheckPermNode(perm, obj, var) Bases: :py:obj:`django.template.Node` .. py:method:: render(context) Return the node rendered as a string. .. py:function:: check_perm(parser, token) A template tag to look up object permissions. The current user is tested agains the given permission on the given object. Current user is taken from the template context, so the ``django.contrib.auth.context_processors.auth`` template context processor must be present in ``settings.TEMPLATE_CONTEXT_PROCESSORS``. Usage: .. code-block:: html+django {% load check_perm %} {% check_perm "some_permission" for some_object as variable %} {% if variable %}

This is shown if the user has some_permission on some_object.

{% endif %}