Skip to content

Refs #31223 -- Added __class_getitem__() to ForeignKey #15571

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

Merged
merged 1 commit into from
Apr 22, 2022

Conversation

collinanderson
Copy link
Contributor

@collinanderson collinanderson commented Apr 8, 2022

This is useful especially for models.ForeignKey('self'). I'm not sure if django-stubs would use them, but django-types would use them:

https://pypi.org/project/django-types/

ticket-31223

Copy link
Member

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

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

I think this is reasonable, thanks.

@carltongibson carltongibson merged commit 0de89b6 into django:main Apr 22, 2022
ngnpope added a commit to ngnpope/django-stubs that referenced this pull request Jul 4, 2022
This matches the change coming in Django 4.1.

See django/django#15571
sobolevn pushed a commit to typeddjango/django-stubs that referenced this pull request Jul 5, 2022
* Add generic monkeypatching for `FileProxyMixin`.

This fixes `TypeError: 'type' object is not subscriptable` for
`django.core.files.File` and `django.core.files.base.ContentFile`.

* Add generic monkeypatching for `ForeignKey`.

This matches the change coming in Django 4.1.

See django/django#15571
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.

2 participants