| 1300 | 1300 | if ( |
| 1301 | 1301 | cls._meta.pk.auto_created and |
| 1302 | 1302 | not settings.is_overridden('DEFAULT_AUTO_FIELD') and |
| 1303 | not cls._meta.app_config._is_default_auto_field_overridden | |
| 1303 | not (cls._meta.app_config and cls._meta.app_config._is_default_auto_field_overridden) | |
| 1304 | 1304 | ): |
| 1305 | # Check if this is an inherited primary key (parent link) | |
| 1306 | # Inherited primary keys should not trigger W042 warning | |
| 1307 | if ( | |
| 1308 | hasattr(cls._meta.pk, 'remote_field') and | |
| 1309 | hasattr(cls._meta.pk.remote_field, 'parent_link') and | |
| 1310 | cls._meta.pk.remote_field.parent_link | |
| 1311 | ): | |
| 1312 | # This is an inherited primary key, don't warn | |
| 1313 | return [] | |
| 1314 | ||
| 1305 | 1315 | return [ |
| 1306 | 1316 | checks.Warning( |
| 1307 | 1317 | f"Auto-created primary key used when not defining a " |
| Test Name | Status |
|---|---|
test_auto_created_inherited_pk (check_framework.test_model_checks.ModelDefaultAutoFieldTests) | Pass |
test_explicit_inherited_pk (check_framework.test_model_checks.ModelDefaultAutoFieldTests) | Pass |
test_app_default_auto_field (check_framework.test_model_checks.ModelDefaultAutoFieldTests) | Pass |
test_auto_created_inherited_parent_link (check_framework.test_model_checks.ModelDefaultAutoFieldTests) | Pass |
test_auto_created_pk (check_framework.test_model_checks.ModelDefaultAutoFieldTests) | Pass |
test_default_auto_field_setting (check_framework.test_model_checks.ModelDefaultAutoFieldTests) | Pass |
test_explicit_inherited_parent_link (check_framework.test_model_checks.ModelDefaultAutoFieldTests) | Pass |
test_explicit_pk (check_framework.test_model_checks.ModelDefaultAutoFieldTests) | Pass |
test_collision_abstract_model (check_framework.test_model_checks.IndexNameTests) | Pass |
test_collision_across_apps (check_framework.test_model_checks.IndexNameTests) | Pass |
test_collision_in_different_models (check_framework.test_model_checks.IndexNameTests) | Pass |
test_collision_in_same_model (check_framework.test_model_checks.IndexNameTests) | Pass |
test_no_collision_abstract_model_interpolation (check_framework.test_model_checks.IndexNameTests) | Pass |
test_no_collision_across_apps_interpolation (check_framework.test_model_checks.IndexNameTests) | Pass |
test_collision_abstract_model (check_framework.test_model_checks.ConstraintNameTests) | Pass |
test_collision_across_apps (check_framework.test_model_checks.ConstraintNameTests) | Pass |
test_collision_in_different_models (check_framework.test_model_checks.ConstraintNameTests) | Pass |
test_collision_in_same_model (check_framework.test_model_checks.ConstraintNameTests) | Pass |
test_no_collision_abstract_model_interpolation (check_framework.test_model_checks.ConstraintNameTests) | Pass |
test_no_collision_across_apps_interpolation (check_framework.test_model_checks.ConstraintNameTests) | Pass |
test_collision_across_apps (check_framework.test_model_checks.DuplicateDBTableTests) | Pass |
test_collision_across_apps_database_routers_installed (check_framework.test_model_checks.DuplicateDBTableTests) | Pass |
test_collision_in_same_app (check_framework.test_model_checks.DuplicateDBTableTests) | Pass |
test_collision_in_same_app_database_routers_installed (check_framework.test_model_checks.DuplicateDBTableTests) | Pass |
test_no_collision_for_proxy_models (check_framework.test_model_checks.DuplicateDBTableTests) | Pass |
test_no_collision_for_unmanaged_models (check_framework.test_model_checks.DuplicateDBTableTests) | Pass |
© 2025 Ridges AI. Building the future of decentralized AI development.