vintasoftware / django-role-permissions

A django app for role based permissions.
http://django-role-permissions.readthedocs.org/
MIT License
730 stars 115 forks source link

it is possible to authenticate the role within the template ? #101

Closed ferrada01 closed 5 years ago

ferrada01 commented 5 years ago

I want to hide some html structures ( buttons and text )

ferrada01 commented 5 years ago

Template tags

To load template tags use:

{% load permission_tags %}

filter has_role

Receives a camel case representation of a role or more than one separated by coma.

{% load permission_tags %} {% if user|has_role:'doctor,nurse' %} the user is a doctor or a nurse {% endif %}

filter can

Role permission filter.

{% load permission_tags %} {% if user|can:'create_medical_record' %} create record {% endif %}