File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
ansible_base/rbac/management Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,11 @@ def create_DAB_contenttypes(
7979 # Update, or set for the first time, the parent type reference
8080 updated_ct = 0
8181 for ct in dab_ct_cls .objects .all ():
82- ct_model_class = model_class (apps , ct )
82+ try :
83+ ct_model_class = model_class (apps , ct )
84+ except LookupError :
85+ logger .warning (f'Model { ct .model } is in the permission_registry but not in the current app state. ' 'This could be okay in reverse migrations.' )
86+ continue
8387 if issubclass (ct_model_class , RemoteObject ):
8488 continue # remote types not managed here
8589 if not permission_registry .is_registered (ct_model_class ):
Original file line number Diff line number Diff line change @@ -14,7 +14,12 @@ def test_courtesy_roles_pass_validation():
1414 if '_base' in template_name :
1515 continue # abstract, not intended to be used
1616 constructor = cls ()
17- perm_list = [DABPermission .objects .get (codename = str_perm ) for str_perm in constructor .get_permissions (apps )]
17+ perm_list = []
18+ for str_perm in constructor .get_permissions (apps ):
19+ if '.' in str_perm :
20+ perm_list .append (DABPermission .objects .get (api_slug = str_perm ))
21+ else :
22+ perm_list .append (DABPermission .objects .get (codename = str_perm ))
1823 model_cls = constructor .get_model (apps )
1924 if model_cls is not None :
2025 ct = permission_registry .content_type_model .objects .get_for_model (constructor .get_model (apps ))
You can’t perform that action at this time.
0 commit comments