Skip to content
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

TypeError: 'type' object is not subscriptable #258

Open
christianbundy opened this issue Sep 27, 2022 · 2 comments
Open

TypeError: 'type' object is not subscriptable #258

christianbundy opened this issue Sep 27, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@christianbundy
Copy link
Contributor

christianbundy commented Sep 27, 2022

Bug report

What's wrong

class Foo(serializers.PrimaryKeyRelatedField[FooModel]): ...
    serializers.PrimaryKeyRelatedField[FooModel]
TypeError: 'type' object is not subscriptable

How is that should be

Success: no issues found in 1 source file

System information

  • OS: Linux f16759b1b324 5.10.104-linuxkit #1 SMP PREEMPT Thu Mar 17 17:05:54 UTC 2022 aarch64 GNU/Linux
  • python version: 3.10.6
  • django version: 4.0.7
  • mypy version: 0.961
  • django-stubs version: 1.12.0

Also, it isn't asked for by the template, but:

  • djangorestframework version: 3.13.1
  • djangorestframework-stubs version: 1.7.0
@christianbundy christianbundy added the bug Something isn't working label Sep 27, 2022
@christianbundy
Copy link
Contributor Author

christianbundy commented Sep 27, 2022

I've seen some open issues about similar problems, but:

  • This doesn't affect other classes, only PrimaryKeyRelatedField
  • The usual suggestion is "upgrade to 3.12+" and I'm on 3.13.

I think this is an unexpected defect, but please let me know if I've just misunderstood the other issues.

@monosans
Copy link

Hope this helps #255 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants