diff options
| author | Adam Johnson <me@adamj.eu> | 2025-04-14 15:46:37 +0100 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2025-09-18 19:44:16 -0400 |
| commit | 74a9c2711cd81708ae754c4d92432511efa96149 (patch) | |
| tree | ed87d70582ad712a93feb4f4d23edf676c566e92 /django/contrib/contenttypes/checks.py | |
| parent | 762d3be8c559b0abf415be8d6117f04fb6347983 (diff) | |
Refs #28586 -- Split descriptor from GenericForeignKey.
This makes GenericForeignKey more similar to other fields which act as
descriptors, preparing it to add “fetcher protocol” support in a clear and
consistent way.
Diffstat (limited to 'django/contrib/contenttypes/checks.py')
| -rw-r--r-- | django/contrib/contenttypes/checks.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/django/contrib/contenttypes/checks.py b/django/contrib/contenttypes/checks.py index aae9dcb31b..392f60a655 100644 --- a/django/contrib/contenttypes/checks.py +++ b/django/contrib/contenttypes/checks.py @@ -5,7 +5,7 @@ from django.core.checks import Error def check_generic_foreign_keys(app_configs, **kwargs): - from .fields import GenericForeignKey + from .fields import GenericForeignKeyDescriptor if app_configs is None: models = apps.get_models() @@ -14,14 +14,14 @@ def check_generic_foreign_keys(app_configs, **kwargs): app_config.get_models() for app_config in app_configs ) errors = [] - fields = ( + descriptors = ( obj for model in models for obj in vars(model).values() - if isinstance(obj, GenericForeignKey) + if isinstance(obj, GenericForeignKeyDescriptor) ) - for field in fields: - errors.extend(field.check()) + for descriptor in descriptors: + errors.extend(descriptor.field.check()) return errors |
