Skip to content

Refs #28586 -- Split descriptor from GenericForeignKey. #19381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adamchainz
Copy link
Member

Trac ticket number

ticket-28586

Branch description

To support field fetching modes for GenericForeignKey, it needs to conform to a new "fetcher protocol", which includes having a field attribute that points from the "fetcher" to the actual field.

The core related fields, like ForeignKey, all use descriptors with a field attribute. These descriptors then act as their "fetcher" class.

GenericForeignKey has always been a bit odd because it does not have a separate descriptor class. This PR removes that oddity by adding such a class and moving the appropriate methods there.

This change follows ticket-35224, which made GenericForeignKey an actual field class.

Checklist

  • This PR targets the main branch.
  • The commit message is written in past tense, mentions the ticket number, and ends with a period.
  • I have checked the "Has patch" ticket flag in the Trac system.
  • I have added or updated relevant tests.
  • I have added or updated relevant docs, including release notes if applicable.
  • I have attached screenshots in both light and dark modes for any UI changes.

@@ -5,7 +5,7 @@


def check_generic_foreign_keys(app_configs=None, **kwargs):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR #17886 attempts to remove this check function, though I haven't managed to get that into a mergeable state yet.

@adamchainz adamchainz force-pushed the ticket_28586_gfk_descriptor branch from 28b6b1f to 7a61735 Compare April 29, 2025 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant