Skip to content

Commit 2a8ddd3

Browse files
committed
Improve type mismatch error
1 parent 5975899 commit 2a8ddd3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ansible_base/rbac/models/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def get_evaluation_model(cls):
3232
# For proxy models, including django-polymorphic, use the id field from parent table
3333
# we accomplish this by inspecting the raw database type of the field
3434
pk_db_type = pk_field.db_type(connection)
35+
3536
for eval_cls in (RoleEvaluation, RoleEvaluationUUID):
3637
if pk_db_type == eval_cls._meta.get_field('object_id').db_type(connection):
3738
return eval_cls
@@ -40,4 +41,4 @@ def get_evaluation_model(cls):
4041
if pk_db_type in ('bigint', 'integer', 'integer unsigned'):
4142
return RoleEvaluation
4243

43-
raise RuntimeError(f'Model {cls._meta.model_name} primary key type of {type(pk_field)} (db type {pk_db_type}) is not supported')
44+
raise RuntimeError(f'Model {cls._meta.model_name} primary key type of {type(cls._meta.pk)} (db type {pk_db_type}) is not supported')

0 commit comments

Comments
 (0)