我正在尝试检查特定组是否有权修改其他类型的组
def can_write_object(self, obj):
return (self.user.is_staff or
self.userprofile.has_permission(obj, Permission.READ_WRITE))
如果policy.can_write_object()
函数返回true
- if groups
- for group in groups
.btn-group
- if policy.can_write_object(group)
%a.btn.btn-mini{
:data-toggle => "modal",
:onclick => "$(\"#groupmodalcontainer\").load(\"{% url group group.id %}\");",
}
Modify Group
但是,我一直收到此错误
TemplateSyntaxError
Could not parse the remainder: '(group)' from 'policy.can_write_object(group)'