djangorestframework-stubs icon indicating copy to clipboard operation
djangorestframework-stubs copied to clipboard

PEP-484 stubs for django-rest-framework

Results 104 djangorestframework-stubs issues
Sort by recently updated
recently updated
newest added

# How to reproduce: 1. Configure mypy like this: ``` [mypy] check_untyped_defs = true disallow_untyped_defs = true ignore_missing_imports = true no_implicit_optional = true warn_redundant_casts = true warn_return_any = true warn_unused_ignores...

DRF does not use raw strings but the ErrorDetail which is a subclass of str See: https://github.com/encode/django-rest-framework/blob/master/rest_framework/exceptions.py#L18

# Bug report ## What's wrong SlugRelatedField has `None` for a default parameter in its init function, but there is an assertion that prevents it from ever being `None`: https://github.com/encode/django-rest-framework/blob/0323d6f8955f987771269506ca5da461e2e7a248/rest_framework/relations.py#L455...

bug

# Bug report ## What's wrong in [settings.pyi](https://github.com/typeddjango/djangorestframework-stubs/blob/466b1f5f0dd2f80eea6fcebb13114118489686a7/rest_framework-stubs/settings.pyi#L23) the type of `ALLOWED_VERSIONS` is hinted to `Optional[str]`. ## How is that should be This setting is typically a list of allowed...

bug

In `method_overridden()`, the `instance` arg is typed as `Model`: https://github.com/typeddjango/djangorestframework-stubs/blob/466b1f5f0dd2f80eea6fcebb13114118489686a7/rest_framework-stubs/relations.pyi#L9 However, [the only time the func is called in drf source](https://github.com/encode/django-rest-framework/search?q=method_overridden) is in [`RelatedField.__init__()`](https://github.com/encode/django-rest-framework/blob/0323d6f8955f987771269506ca5da461e2e7a248/rest_framework/relations.py#L106) checking that `get_queryset()` is overridden: ```py...

Define `urlpatterns` as `Iterable`, they are only iterated over inside `apply_suffix_patterns`. Define `allowed` as `Optional[Sequence[...]]` instead as it is documented as tuple/list and needs to support `__len__` and `__getitem__`. Closes...

I spent some time trying to get the tests to run. Apart from pointing `django-stubs` at https://github.com/typeddjango/django-stubs/pull/786, I had to make two more changes 1. `types-requests` no longer vendors `urllib3`...

I have the following serializer: ``` class ReportConfigurationSerializer(serializers.ModelSerializer[ReportScheduleConfiguration]): created_by = serializers.SlugRelatedField(read_only=True, slug_field="email") generation_settings = ReportGenerationSettingsJSONField(read_only=True) send_time_zone = TimeZoneSerializerField() class Meta: model = ReportScheduleConfiguration fields = ( "id", "name", "send_time", "send_time_zone",...

bug

``` @permission_classes([IsAuthenticated|ReadOnly]) ``` The above snippet doesn't work because the operator doesn't return `permissions.BasePermission` object. It returns `permissions.OperandHolder`. So the stub should be allowing for this type to be in...

bug