轉(zhuǎn)載:http://maplye.iteye.com/blog/448960
記錄下自己用到的:
1.Permissions{{ perms.foo }},一個(gè)已經(jīng)登陸的用戶對(duì)foo的app只要有任何的權(quán)限灼舍,{{ perms.foo }}就會(huì)等于True,反之為False{{ perms.foo.can_vote }}, 這個(gè)很清楚了...實(shí)例如下:
{% if perms.foo %}
<p>You have permission to do something in the foo app.</p>
{% if perms.foo.can_vote %}
<p>You can vote!</p>
{% endif %}
{% if perms.foo.can_drive %}
<p>You can drive!</p>
{% endif %}
{% else %}
<p>You don't have permission to do anything in the foo app.</p>{% endif %}