django-stubs
django-stubs copied to clipboard
PEP-484 stubs for Django
Hi. I'm getting `is nullable but its generic get type parameter is not optional` for fields with derived `ForeignKey` field types. Given my main model uses a "name" as primary...
# Bug report ## What's wrong When running django-stubs 5.0.2, mypy goes through without error. But when updating django-stubs to 5.0.3, I’m getting the following error: `error: INTERNAL ERROR: maximum...
Bumps [black](https://github.com/psf/black) from 24.8.0 to 24.10.0. Release notes Sourced from black's releases. 24.10.0 Highlights Black is now officially tested with Python 3.13 and provides Python 3.13 mypyc-compiled wheels. (#4436) (#4449)...
# I have made things! This change also adds a few user type vars and alises to cover the common use cases of ``User``, ``User | AnonymousUser``, and their ``TypeVar``...
# Bug report ## What's wrong I am trying to define an alias for an annotated model to be used as parameter type for a function header. ``` class MyModelExtra(TypedDict):...
# Bug report wrote a little testcase -- will see if I can figure out a quick fix for it ```yaml - case: test_annotate_reverse_related main: | from myapp.models import MB...
# Bug report ## What's wrong ```python class Tag(models.Model): pass class Article(models.Model): tags = models.ManyToManyField(to=Tag, related_name="articles", blank=True) def method(self): published_articles = Article.objects.exclude(pk=self.pk) for tag in self.tags.all().prefetch_related( Prefetch("articles", published_articles, to_attr="published_articles") ):...
# Updating the _Choices type alias Django 5 allows model field choices to be callables, mappings or subclasses of `models.Choices`. This PR introduces these options in the stubs. ## Related...
Introduced in #2335, `_UserModel` type alias is resolved by plugin to point to current `AUTH_USER_MODEL`. This functionality is extremely helpful in certain circumstances, esp. when typing django-related packages. I was...
# Bug report `django_stubs_ext.monkeypatch()` now tries to import `django.contrib.auth.forms`, but in some cases that breaks due to import cycles. **`pyproject.toml`** ```toml [project] name = "django-stubs-test" version = "0.1.0" requires-python =...