django-stubs
django-stubs copied to clipboard
PEP-484 stubs for Django
# Bug report ## What's wrong Currently, trying to use an attribute of a file from `request.FILES` that I know exists because I've set `settings.FILE_UPLOAD_HANDLERS` explicitly still results in a...
# I have made things! This adds type annotations for `run`, `get_handler`, `inner_run` and `server_cls`. [perm link to the relevant source code](https://github.com/django/django/blob/03eec9ff6cc78e7c1bcf88bb76ecd11f0d433c72/django/core/management/commands/runserver.py) ## Related issues None
# Bug report When a Model class includes properties with setters, Django allows assigning values to them via the Model constructor. But django-stubs does not allow that and shows a...
# Bug report ## What's wrong I am trying to use the `WithAnnotations` as documented with two parameters. The first is a django model, and the second is a typed...
admin.TabularInline: Signature of "has_add_permission" incompatible with supertype "BaseModelAdmin"
## What's wrong The signature for the `admin.TabularInline.has_add_permission` method seems to be wrongly typed, resulting in the following error when a subclass declares a type according to the Django documentation:...
When I create `model.py` with the following content: ```python # -*- coding: utf-8 -*- from django.contrib.auth import get_user_model from django.db import models User = get_user_model() class BlogPost(models.Model): """Example model with...
# Bug report Trying to apply the suggestion, how to assign authenticated user to the request: ```python from typing import Any from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from...
# Bug report ## What's wrong The clean method for Django forms is currently defined as [`Optional[Dict[str, Any]]`](https://github.com/typeddjango/django-stubs/blob/master/django-stubs/forms/forms.pyi#L60). ## How is that should be Since the clean method just returns...
I am seeing the following error: > "_MonkeyPatchedWSGIResponse" has no attribute "content"; maybe "context"? [attr-defined] It gets set in the constructor: https://github.com/django/django/blob/73b4f3f9b3c2c64482c8a1174b3c5ab208d11279/django/http/response.py#L355 And it is typed properly: https://github.com/typeddjango/django-stubs/blob/008662c09753ab3e472151ced743e18e6f85716e/django-stubs/http/response.pyi#L87-L88 But the...
# Bug report ## What's wrong After adding django-cte to a codebase I got an `Internal error` from mypy and traced it down to the presence of the `django-stubs` mypy...