我正在尝试检查特定组是否有权修改另一种类型的组
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)'