We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
For a model Model with a field such as:
Model
class TestModel(django.db.models.Model): bar = django_enum.EnumField(enums.Bar, default=enums.Bar.FOO)
and code such as:
foo = TestModel() foo.bar = enums.Bar.FOO
gives the following in pyright:
Cannot assign member "bar" for type "TestModel" "Literal[Bar.FOO]" is incompatible with "_ST@Field"
The VSCode IDE which also uses pyright reports the same error however when inspecting the field type it is shown as _GT@Field
_GT@Field
Forcing the type in the model definition as EnumMixin such as follows, makes no difference:
EnumMixin
class TestModel(django.db.models.Model): bar: django_enum.fields.EnumMixin = django_enum.EnumField(enums.Bar, default=enums.Bar.FOO)
I'd rather not disable type checking on all django-enum assignments if I can avoid it. Should I be raising this with the djang-enum project instead?
djang-enum
Any help/advice greatly appreciated
The text was updated successfully, but these errors were encountered:
Hmm this is tricky! I believe I used django-enum on a past project, but can't remember how we got it to work or if we stopped using it
It might make sense to create type stubs for django-enum (.pyi files) to get pyright / mypy to behave
Sorry, something went wrong.
No branches or pull requests
For a model
Model
with a field such as:and code such as:
gives the following in pyright:
The VSCode IDE which also uses pyright reports the same error however when inspecting the field type it is shown as
_GT@Field
Forcing the type in the model definition as
EnumMixin
such as follows, makes no difference:I'd rather not disable type checking on all django-enum assignments if I can avoid it.
Should I be raising this with the
djang-enum
project instead?Any help/advice greatly appreciated
The text was updated successfully, but these errors were encountered: