djangorestframework-stubs
djangorestframework-stubs copied to clipboard
PEP-484 stubs for django-rest-framework
# Bug report ## What's wrong `BaseSerializer.is_valid` should return `NoReturn` when takes `raise_exception=True` Now mypy fails with ```shell error: Missing return statement [return] ``` ## How is that should be...
Updates the requirements on [mypy](https://github.com/python/mypy) to permit the latest version. Commits 1f08cf4 Update version to 0.971 61c0064 Add back workaround to avoid confusing mypy.types and types in pyinfo (#13176) d8d900c...
I have a custom user model that inherits from AbstractBaseUser, but when I do something like `request.user.id`, pyright thinks that `user` is of type AbstractBaseUser (instead of my class MyUser)...
If a serializer has a field named the same as DRF's `Serializer` class properties; `data`, `errors` and `fields`, an assignment error will be thrown.
Right now `typecheck` tests fail with: ``` drf_source/tests/test_permissions.py:548: error: "object" not callable drf_source/tests/test_permissions.py:554: error: "object" not callable drf_source/tests/test_permissions.py:608: error: "object" not callable drf_source/tests/test_permissions.py:615: error: Cannot assign multiple types to name...
# Bug report For `mixin` you cannot specify the type of `request` as it got incompatible with base `View` ## What's wrong ```python from rest_framework import mixins from rest_framework import...
# Bug report ## What's wrong Given the snippet such as this ```python3 from rest_framework.response import Response from rest_framework.test import APIClient def test_response(api_client: APIClient) -> None: response: Response = api_client.get('https://example.com/example.json')...
Version 1.4.0 of DRF-stubs and Following along with the DRF tutorial I've got the following pattern (mypy output inline in comments): ```python urlpatterns = [ path("tree/", views.NodeList.as_view()), path("tree/", views.NodeDetail.as_view()), ]...
# Bug report ## What's wrong In api_settings, [`DEFAULT_FILTER_BACKENDS`](https://github.com/typeddjango/djangorestframework-stubs/blob/master/rest_framework-stubs/settings.pyi#L84) is typed as `Sequence[str]`, but it is used in [`GenericAPIView`](https://github.com/encode/django-rest-framework/blob/e5fb9af0eaffde683fa0af3987085f86cf0d2640/rest_framework/generics.py#L43), which is typed as [`Sequence[Union[Type[BaseFilterBackend], Type[BaseFilterProtocol[_MT_co]]]]`](https://github.com/typeddjango/djangorestframework-stubs/blob/master/rest_framework-stubs/generics.pyi#L37). ## How is that should...
# Bug report ## What's wrong The stubs say that `ReturnDict` has `serializer` as first argument, but actually it's a keyword only argument. First argument should be a Mapping. (or...