-
@admin.register(Foo)
class FooAdmin(admin.ModelAdmin):
... Pyright:
With: @admin.register(Foo)
class FooAdmin(admin.ModelAdmin[Foo]):
... Pyright is happy but now the code doesn't run because the real Any ideas here? |
Beta Was this translation helpful? Give feedback.
Answered by
sbdchd
Apr 7, 2023
Replies: 1 comment
-
Yeah if it works at compile time but explodes at runtime you can monkey patch the underlying class to have a for cls in [admin.ModelAdmin]:
cls.__class_getitem__ = classmethod(lambda cls, *args, **kwargs: cls) # type: ignore [attr-defined] |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
knyghty
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yeah if it works at compile time but explodes at runtime you can monkey patch the underlying class to have a
__class_getitem__
method: