浏览代码

fix permission error on ModelLookupForm (#174)

Breno Rocha Uchôa 8 年之前
父节点
当前提交
7b956bc940
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      jet/forms.py

+ 1 - 1
jet/forms.py

@@ -119,7 +119,7 @@ class ModelLookupForm(forms.Form):
         content_type = ContentType.objects.get_for_model(self.model_cls)
         permission = Permission.objects.filter(content_type=content_type, codename__startswith='change_').first()
 
-        if not self.request.user.has_perm(permission.codename):
+        if not self.request.user.has_perm('{}.{}'.format(data['app_label'], permission.codename)):
             raise ValidationError('error')
 
         return data