diff --git a/web_access_rule_buttons/models.py b/web_access_rule_buttons/models.py index a4ef8b18..3817f648 100644 --- a/web_access_rule_buttons/models.py +++ b/web_access_rule_buttons/models.py @@ -19,6 +19,12 @@ def check_access_rule_all(self, operations=None): operations = ['read', 'create', 'write', 'unlink'] result = {} for operation in operations: + if self.is_transient() and not self.ids: + # If we call check_access_rule() without id, it will try to run a + # SELECT without ID which will crash, so we just blindly allow the + # operations + result[operation] = True + continue try: self.check_access_rule(operation) except exceptions.AccessError: