File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -389,18 +389,14 @@ class Meta:
389389 app_label = 'dab_rbac'
390390 abstract = True
391391
392- def __init__ (self , * args , ** kwargs ):
393- super ().__init__ (* args , ** kwargs )
394-
395- # Fields from object_role are cached onto assignment objects, only when creating new assignments
396- # we must be very careful to avoid referencing deferred attributes to avoid RecursionError
397- def_fields = self .get_deferred_fields ()
398- if not ({'id' , 'object_id' , 'object_role_id' } & def_fields ):
399- if (not self .id ) and self .object_role_id and (not self .object_id ):
392+ def save (self , * args , ** kwargs ):
393+ if not self .id : # usually only new objects can be saved, but super needs to do error handling
394+ if self .object_role_id and (not self .object_id ):
400395 # Cache fields from the associated object_role
401396 self .object_id = self .object_role .object_id
402397 self .content_type_id = self .object_role .content_type_id
403398 self .role_definition_id = self .object_role .role_definition_id
399+ return super ().save (* args , ** kwargs )
404400
405401
406402class RoleUserAssignment (AssignmentBase ):
You can’t perform that action at this time.
0 commit comments