定义用户model时可以给用户分配权限:
class Meta:
permissions = (
("can_mark", "Can mark"),
)
views里的判断:
if request.user.has_perm('accounts.can_mark'):
或者在模板里
{% if perms.accounts %}
<p>You have permission to do something in the polls app.</p>
{% if perms.accounts.can_vote %}
<p>You can vote!</p>
{% endif %}
{% else %}
<p>You don't have permission to do anything in the polls app.</p>
{% endif %}