PEP-484 stubs for Django
This is a re-release of django-stubs 5.0.1
with a minor fix:
django-stubs-ext
dependency to 5.0.2
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/2186
Full Changelog: https://github.com/typeddjango/django-stubs/compare/5.0.1...5.0.2
Support for Django 4.1 have been dropped by @sobolevn in https://github.com/typeddjango/django-stubs/pull/2133
A new extra, django-stubs[oracle]
, was added by @sobolevn in https://github.com/typeddjango/django-stubs/pull/2131
Remove QuerySet alias hacks via PEP 696 TypeVar defaults. All usages of QuerySetAny
and ValuesQuerySet
can now be replaced with simple QuerySet
by @intgr in https://github.com/typeddjango/django-stubs/pull/2104
django.contrib.admin.views
and django.forms.forms.Form
metaclass by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2079
django.db.models.lookups
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2103
django.db.backends.utils
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2102
django.forms.field.Field
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2107
django.contrib.messages.storage.cookie
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2106
django.db.models.expressions
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2110
django.contrib.auth.backends
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2111
django.contrib.auth.base_user
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2113
django.db.migrations.serializer
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2109
django.db.backends.base.features.BaseDatabaseFeature
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2099
django.db.backends.base.operations.BaseDatabaseOperations
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2100
request.auser
by @bshelkhonov in https://github.com/typeddjango/django-stubs/pull/2108
django.contrib.gis.admin.widgets
and django.contrib.gis.admin.options
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2116
django.forms.boundfield
and django.forms.utils
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2118
BaseBackend.get_user
: Relax user_id
param type by @tony in https://github.com/typeddjango/django-stubs/pull/2121
django.forms.renderers
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2119
django.forms.forms
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2122
django.contrib.gis.db.backends.sqatialite.schema
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2123
schema
modules by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2124
django.contrib.messages.test
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2126
django.contrib.contenttypes.prefetch
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2115
django.contrib.admin.widgets
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2105
django.contrib.contenttypes.fields.GenericForeignKey
methods by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2137
backend
in django.contrib.auth
(ModelBackend
-> BaseBackend
) by @tony in https://github.com/typeddjango/django-stubs/pull/2141
Query.resolve_lookup_value()
parameters by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2136
django.forms.models
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2146
django.db.migrations.autodetector
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2149
django.db.models.enums
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2148
django.forms.widgets
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2147
django-stubs-ext
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/2150
django.db.models.field.related
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2151
TextChoices.__new__()
parameter type by @mvaled in https://github.com/typeddjango/django-stubs/pull/2156
django.contrib.gis.db.backends.postgis.operations
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2138
django.db.models.fields.reverse_related
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2158
django.db.models.field
: add generated
attribute to model fields by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2152
django.db.models.sql.datastructures
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2159
django.db.models.query
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2160
django.db.models.sql.compiler
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2166
django.db.models.functions.datetime
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2167
django.forms.formsets
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2145
django.db.models.query_utils
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2165
django.db.models.functions.datetime.Now
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2173
django.db.models.sql.query.Query
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2172
django.db.models.field.related_descriptors
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2157
django.db.models.expressions
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2176
BaseConstraint.get_violation_error_message()
by @q0w in https://github.com/typeddjango/django-stubs/pull/2178
assert_type
test cases, run pyright
by @Viicos in https://github.com/typeddjango/django-stubs/pull/2162
AbstractBaseSession
: Use model fields for subclassed cases by @tony in https://github.com/typeddjango/django-stubs/pull/2180
5.0.1
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/2183
Full Changelog: https://github.com/typeddjango/django-stubs/compare/5.0.0...5.0.1
Support for Django 4.1 have been dropped by @sobolevn in https://github.com/typeddjango/django-stubs/pull/2133
A new extra, django-stubs[oracle]
, was added by @sobolevn in https://github.com/typeddjango/django-stubs/pull/2131
Remove QuerySet alias hacks via PEP 696 TypeVar defaults. All usages of QuerySetAny
and ValuesQuerySet
can now be replaced with simple QuerySet
by @intgr in https://github.com/typeddjango/django-stubs/pull/2104
django.contrib.admin.views
and django.forms.forms.Form
metaclass by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2079
django.db.models.lookups
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2103
django.db.backends.utils
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2102
django.forms.field.Field
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2107
django.contrib.messages.storage.cookie
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2106
django.db.models.expressions
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2110
django.contrib.auth.backends
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2111
django.contrib.auth.base_user
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2113
django.db.migrations.serializer
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2109
django.db.backends.base.features.BaseDatabaseFeature
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2099
django.db.backends.base.operations.BaseDatabaseOperations
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2100
request.auser
by @bshelkhonov in https://github.com/typeddjango/django-stubs/pull/2108
django.contrib.gis.admin.widgets
and django.contrib.gis.admin.options
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2116
django.forms.boundfield
and django.forms.utils
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2118
BaseBackend.get_user
: Relax user_id
param type by @tony in https://github.com/typeddjango/django-stubs/pull/2121
django.forms.renderers
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2119
django.forms.forms
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2122
django.contrib.gis.db.backends.sqatialite.schema
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2123
schema
modules by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2124
django.contrib.messages.test
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2126
django.contrib.contenttypes.prefetch
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2115
django.contrib.admin.widgets
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2105
django.contrib.contenttypes.fields.GenericForeignKey
methods by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2137
backend
in django.contrib.auth
(ModelBackend
-> BaseBackend
) by @tony in https://github.com/typeddjango/django-stubs/pull/2141
Query.resolve_lookup_value()
parameters by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2136
django.forms.models
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2146
django.db.migrations.autodetector
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2149
django.db.models.enums
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2148
django.forms.widgets
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2147
django-stubs-ext
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/2150
django.db.models.field.related
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2151
TextChoices.__new__()
parameter type by @mvaled in https://github.com/typeddjango/django-stubs/pull/2156
django.contrib.gis.db.backends.postgis.operations
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2138
django.db.models.fields.reverse_related
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2158
django.db.models.field
: add generated
attribute to model fields by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2152
django.db.models.sql.datastructures
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2159
django.db.models.query
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2160
django.db.models.sql.compiler
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2166
django.db.models.functions.datetime
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2167
django.forms.formsets
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2145
django.db.models.query_utils
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2165
django.db.models.functions.datetime.Now
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2173
django.db.models.sql.query.Query
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2172
django.db.models.field.related_descriptors
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2157
django.db.models.expressions
by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2176
BaseConstraint.get_violation_error_message()
by @q0w in https://github.com/typeddjango/django-stubs/pull/2178
assert_type
test cases, run pyright
by @Viicos in https://github.com/typeddjango/django-stubs/pull/2162
AbstractBaseSession
: Use model fields for subclassed cases by @tony in https://github.com/typeddjango/django-stubs/pull/2180
5.0.1
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/2183
Full Changelog: https://github.com/typeddjango/django-stubs/compare/5.0.0...5.0.1
QuerySet
class no longer derives from Collection
. If you run into errors like incompatible type "_QuerySet[User, User]"; expected "Collection[User]"
, please read this announcement.Collection
base class and __contains__
method from QuerySet
by @fidoriel in https://github.com/typeddjango/django-stubs/pull/1925
ManyRelatedManager.through
attribute and generic type parameter by @flaeppe in https://github.com/typeddjango/django-stubs/pull/2026
StrPromise
not inherit from Sequence[str]
by @intgr in https://github.com/typeddjango/django-stubs/pull/1841
AppConfig.models_module
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1866
None
in settings MIGRATION_MODULES
dict values by @asottile in https://github.com/typeddjango/django-stubs/pull/1871
JSONField.from_db_value
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1879
converters
in urls.resolvers
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1892
@type_check_only
to all Protocols and known stubs-only classes by @intgr in https://github.com/typeddjango/django-stubs/pull/1894
ModuleType
as a possible type to URLResolver.urlconf_name
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1891
URLPattern.default_args
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1895
PYI046
by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1907
EmailBackend.ssl_keyfile
and EmailBackend.ssl_certfile
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1911
django.VERSION
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1916
CommandParser
to commands.__init__
by @jamesbraza in https://github.com/typeddjango/django-stubs/pull/1927
assume_scheme
to forms.URLField by @asottile in https://github.com/typeddjango/django-stubs/pull/1929
BaseModelAdmin.formfield_for_dbfield
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1934
pre-commit==3.6.1
by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1936
Response.set_cookie.max_age
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1941
core.signing
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1945
core.validators
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1947
core.paginator
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1946
forms.ModelChoiceField
by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1889
set
in model_to_dict
's exclude
by @jamesbraza in https://github.com/typeddjango/django-stubs/pull/1952
BaseEngine.template_dirs
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1954
extra_context
on TemplateView
s by @samueljsb in https://github.com/typeddjango/django-stubs/pull/1994
pytest-mypy-plugins
to 3.1.1 by @sobolevn in https://github.com/typeddjango/django-stubs/pull/2003
django.contrib.auth
by @ngnpope in https://github.com/typeddjango/django-stubs/pull/2009
django.conf
by @ngnpope in https://github.com/typeddjango/django-stubs/pull/2008
django.views
by @ngnpope in https://github.com/typeddjango/django-stubs/pull/2007
django.test
by @ngnpope in https://github.com/typeddjango/django-stubs/pull/2005
django.utils
by @ngnpope in https://github.com/typeddjango/django-stubs/pull/2006
stubtest
by @sobolevn in https://github.com/typeddjango/django-stubs/pull/2015
Q
methods: check()
, flatten()
by @Alexerson in https://github.com/typeddjango/django-stubs/pull/1899
utils.termcolors
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1901
PRI_MYPY
in get_additional_deps
hook by @sobolevn in https://github.com/typeddjango/django-stubs/pull/2024
_default_manager
and _base_manager
to be Manager
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/2022
django.contrib.admin
by @ngnpope in https://github.com/typeddjango/django-stubs/pull/2004
core.files
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1949
core.cache.backends
, add RedisCache
and related classes by @Viicos in https://github.com/typeddjango/django-stubs/pull/1948
AsyncClient.defaults
attribute typing by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1878
fields
argument of Model.refresh_from_db()
by @mthuurne in https://github.com/typeddjango/django-stubs/pull/2035
AdminSite.get_model_admin
generic by @Viicos in https://github.com/typeddjango/django-stubs/pull/2038
db_default=
parameter to models Field
classes by @Skorpyon in https://github.com/typeddjango/django-stubs/pull/1876
class Meta
from Model
and Form
class stubs by @jorenham in https://github.com/typeddjango/django-stubs/pull/2000
ManyToOneRel.get_accessor_name()
by @mthuurne in https://github.com/typeddjango/django-stubs/pull/2052
DeferredAttribute.__get__()
by @mthuurne in https://github.com/typeddjango/django-stubs/pull/2050
FieldFile
by @mthuurne in https://github.com/typeddjango/django-stubs/pull/2051
db_comment=
parameter to Postgres and GIS model fields by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2054
db.models.sql.query.Query.join()
argument by @mthuurne in https://github.com/typeddjango/django-stubs/pull/2055
django.db.backends.oracle.base
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2057
django.test.client
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2059
django.test.html
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2060
django.test.runner
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2061
django.template
, django.templatetags
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2063
django.test.testcases
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2062
django.http
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2064
django.core.management
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2067
django.core.handlers
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2066
django.contrib.sessions.serializers
, django.core.serializers
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2068
returncode
attribute to CommandError
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/2072
ignore_missing_imports
option by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2058
django.core.servers.basehttp
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2070
django.template.base.Template.render()
argument type by @Majsvaffla in https://github.com/typeddjango/django-stubs/pull/1160
django.utils.choices
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2075
django.contrib.sitemaps
, django.contrib.staticfiles
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2076
reportMissingTypeArgument
, reportPrivateUsage
) by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2077
django.contrib.postgres
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2078
path
signature for async views by @jlost in https://github.com/typeddjango/django-stubs/pull/2085
Reversible
base class from QuerySet
by @intgr in https://github.com/typeddjango/django-stubs/pull/2094
Full Changelog: https://github.com/typeddjango/django-stubs/compare/4.2.7...5.0.0
ManyToManyField
and Model.<manytomany>.through
RelatedManager
or ManyRelatedManager
, update those to django-stubs-ext:
from django_stubs_ext.db.models.manager import ManyRelatedManager, RelatedManager
@cached_property
properties with class variables or @property
properties.ManyToManyDescriptor
and fixed Model.<manytomany>.through
typing by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1805
Self
-typed custom queryset methods to be compatible with QuerySet
by @moranabadie in https://github.com/typeddjango/django-stubs/pull/1852
RelatedManager
, ManyRelatedManager
stub-only classes by @intgr in https://github.com/typeddjango/django-stubs/pull/1834
TypedModelMeta
ordering
attribute to allow OrderBy
objects by @HansAarneLiblik in https://github.com/typeddjango/django-stubs/pull/1847
search_help_text=
parameter to ChangeList.__init__()
by @quinox in https://github.com/typeddjango/django-stubs/pull/1801
migrations.RunSQL()
by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1803
SuccessMessageMixin.form_valid()
by @SukiCZ in https://github.com/typeddjango/django-stubs/pull/1812
db_comment=
parameter position for django.db.models.Field.__init__()
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1815
RelatedField.__init__()
method and removed ForeignObject.__init__(db_constraint=)
parameter in Field constructors by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1816
assertNumQueries()
and assertQuerySetEqual()
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1823
get_deleted_objects()
return from list[Model]
-> list[str]
by @golgor in https://github.com/typeddjango/django-stubs/pull/1825
django.db.models
re-exports by @intgr in https://github.com/typeddjango/django-stubs/pull/1835
TemplateResponse.cookies
attribute and SimpleCookie
type by @apollo13 in https://github.com/typeddjango/django-stubs/pull/1702
django.contrib.postgres.expressions
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1765
django.contrib.gis.gdal.libgdal
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1811
@deconstructible
as a mixin class by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1818
django.db.models.enums.*
modules by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1819
BaseExpression.contains_subquery()
method (update to Django 4.2.7) by @intgr in https://github.com/typeddjango/django-stubs/pull/1827
QuerySet
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1822
Collector
and NestedObjects
attributes, methods by @intgr in https://github.com/typeddjango/django-stubs/pull/1826
django.db.models.functions.MD5()
database function by @kevinmarsh in https://github.com/typeddjango/django-stubs/pull/1830
BaseModelAdmin
attributes to be either list or tuple by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1832
BaseModelAdmin
methods to return either list or tuple by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1833
capfirst()
None
return by @intgr in https://github.com/typeddjango/django-stubs/pull/1842
django.core.management.commands
modules by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1829
Model._do_update()
method signature by @pfouque in https://github.com/typeddjango/django-stubs/pull/1854
functools.cached_property
definition instead of defining our own by @intgr in https://github.com/typeddjango/django-stubs/pull/1771
@property
attributes to @cached_property
part 1 by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1761
@property
attributes to @cached_property
part 2 by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1768
output_field
to @cached_property
or ClassVar
and improves type by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1769
<Model>_RelatedManager
entries to allowlist by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1806
RelatedManager
to django.db.models.fields.related_descriptors
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1814
RelatedManager
, ManyRelatedManager
to inherit from Manager
not BaseManager
by @intgr in https://github.com/typeddjango/django-stubs/pull/1843
Full Changelog: https://github.com/typeddjango/django-stubs/compare/4.2.6...4.2.7
Fixed several bugs in version 4.2.5. Thanks to everyone for contributing fixes on a short order!
Removed direct mypy dependency. If you are using mypy, please add an explicit mypy
dev dependency to your project, or install django-stubs with the extra django-stubs[compatible-mypy]
.
Mypy remains the only supported type checker. Improvements for other type checkers may be considered in the future, pull requests welcome. See #1628 for details.
as_manager()
and from_queryset()
when combined with Self
types (#1788) by @moranabadie in https://github.com/typeddjango/django-stubs/pull/1789
from_queryset()
of custom Manager subclass by @moranabadie in https://github.com/typeddjango/django-stubs/pull/1786
parse_bool
implementation from mypy" by @intgr in https://github.com/typeddjango/django-stubs/pull/1792
(Turns out this was not necessary and will be reverted)Field.formfield()
, GeometryField.formfield()
method arguments by @brianhelba in https://github.com/typeddjango/django-stubs/pull/1778
django.core.management
modules by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1787
django.db.backend.base
modules by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1791
Full Changelog: https://github.com/typeddjango/django-stubs/compare/4.2.5...4.2.6
mypy 1.6: Recommended mypy version updated to 1.6.x
Next django-stubs version (4.2.6) will remove direct mypy dependency. If you are using mypy, please add an explicit mypy
dev dependency to your project, or install django-stubs with the extra django-stubs[compatible-mypy]
.
Mypy remains the only supported type checker. Improvements for other type checkers may be considered in the future, pull requests welcome. See #1628 for details.
Officially added Python 3.12 support
default_storage
produce a Storage
object by @brianhelba in https://github.com/typeddjango/django-stubs/pull/1665
SyndicationFeed
methods by @WhyNotHugo in https://github.com/typeddjango/django-stubs/pull/1705
Migration.operations
attribute by @asottile in https://github.com/typeddjango/django-stubs/pull/1707
Migration
list attributes by @brianhelba in https://github.com/typeddjango/django-stubs/pull/1710
bases=
parameter in CreateModel
migration op to allow for mixins by @asottile in https://github.com/typeddjango/django-stubs/pull/1708
_Composable
protocol for compatibility with psycopg2-stubs
change by @andersk in https://github.com/typeddjango/django-stubs/pull/1714
django.views
modules by @GabDug in https://github.com/typeddjango/django-stubs/pull/1716
null
and validators
arguments from ManyToManyField.__init__
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1720
django.test
modules by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1752
BaseModelForm
, ErrorList
, ErrorDict
constructor renderer=
parameter by @GabDug in https://github.com/typeddjango/django-stubs/pull/1690
deconstruct
methods by @brianhelba in https://github.com/typeddjango/django-stubs/pull/1695
SQLCompiler
methods by @ashm-tech in https://github.com/typeddjango/django-stubs/pull/1689
max_length
attribute to forms.FileField
by @GabDug in https://github.com/typeddjango/django-stubs/pull/1715
Layer.num_feat
attribute (GeoDjango) by @niconoe in https://github.com/typeddjango/django-stubs/pull/1722
AbstractBaseUser.REQUIRED_FIELDS
as ClassVar
by @WhyNotHugo in https://github.com/typeddjango/django-stubs/pull/1737
fields.Field.formfield()
method by @WhyNotHugo in https://github.com/typeddjango/django-stubs/pull/1739
ModelStateFieldsCacheDescriptor.__get__
method by @asottile in https://github.com/typeddjango/django-stubs/pull/1743
Model._meta
to ClassVar[Options[Self]]
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1732
django.test.signals
types by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1751
@cached_property
decorated method by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1766
psycopg2.sql.SQL
in QuerySet.raw()
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1767
django.middleware.csrf
module by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1770
django.core.cache
modules by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1774
Field.formfield()
, GeometryField.formfield()
methods by @brianhelba in https://github.com/typeddjango/django-stubs/pull/1724
F.resolve_expression()
return type by @schinckel in https://github.com/typeddjango/django-stubs/pull/1659
Manager
methods through manager MRO by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1701
functools.cached_property
instead of Django's in mypy plugin by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1721
ReverseOneToOneDescriptor
and start using it by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1733
ManyToManyField
's through
model by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1719
settings.AUTH_USER_MODEL
used as to=
in relation by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1746
_default_manager
symbol to generated through
model by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1745
AssertionError
crashes.AssertionError
crashes.ValueError
crashes.django_stubs_ext
by @tony in https://github.com/typeddjango/django-stubs/pull/1747 & https://github.com/typeddjango/django-stubs/pull/1748
deconstruct
methods. by @brianhelba in https://github.com/typeddjango/django-stubs/pull/1693 & https://github.com/typeddjango/django-stubs/pull/1694
parse_bool
implementation from mypy by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1703
# type: ignore
comments for plugin code by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1726
# type: ignore
comments in stubs files by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1734
Manager.from_queryset()
handles invalid argument types by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1731
Full Changelog: https://github.com/typeddjango/django-stubs/compare/4.2.4...4.2.5
Most important changes:
1.5.*
support and update [compatible-mypy]
extra to use 1.5.*
.4.2.5
(and all prior versions of 4.2
).django_stubs_ext/
folder was renamed to be just ext/
, it should not affect users (unless you install it from git)objects
attribute to be present on generic Model classes. As per the django documentation, code working with generic models should use the _default_manager
attribute instead.This time there is no corresponding release of django-stubs-ext
.
ClassVar
s https://github.com/typeddjango/django-stubs/pull/1672 @flaeppeThanks a lot to all contributors and maintainers! 🎉
This version fixes two regressions in previons django-stubs
release and also a few other fixes and improvements. Special thanks to @GabDug for contributing regression fixes on a short order.
This time there is no corresponding release of django-stubs-ext
.
AppConfig
and assigning string to default_auto_field
by @GabDug in https://github.com/typeddjango/django-stubs/pull/1596
MiddlewareMixin.__call__()
and using return self.get_response()
by @GabDug in https://github.com/typeddjango/django-stubs/pull/1595
None
as redirect_field_name
value for @user_passes_test
and @login_required
decorators by @JoeHitchen in https://github.com/typeddjango/django-stubs/pull/1600
Date(Time)Field
when using mypy setting disallow_any_explicit
by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1599
BigIntegerField.MAX_BIGINT
attribute by @asottile in https://github.com/typeddjango/django-stubs/pull/1598
pytest-mypy-plugins
by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1601
_typeshed.Self
usages to typing_extensions.Self
(PEP 673) by @intgr in https://github.com/typeddjango/django-stubs/pull/1591
Full Changelog: https://github.com/typeddjango/django-stubs/compare/4.2.2...4.2.3
mypy 1.4: Recommended mypy version updated to 1.4.x
Support for django-split-settings
, django-configurations
and other Django settings addons with strict_settings = false
option, see README for details
We have now adopted mypy's stubtest to automatically find discrepancies between Django and django-stubs.
If you want to contribute to django-stubs but are not sure where to start, have a look at stubtest's TODO list file, which lists the many issues discovered by stubtest.
AppConfig
class to match Django 4.2 by @Alexerson in https://github.com/typeddjango/django-stubs/pull/1524
ManifestStaticFilesStorage
new parameters by @Alexerson in https://github.com/typeddjango/django-stubs/pull/1528
Sitemap
class by @Alexerson in https://github.com/typeddjango/django-stubs/pull/1527
headers=
parameter to (Async)RequestFactory
and (Async)Client
classes by @Alexerson in https://github.com/typeddjango/django-stubs/pull/1529
^
and ~
operator support, JSON lookup classes, Postgres lookup classes, ModelForm
changes, json_script
template filter parameters by @Alexerson in https://github.com/typeddjango/django-stubs/pull/1536
db.backends
DatabaseIntrospection
and DatabaseOperations
classes by @GabDug in https://github.com/typeddjango/django-stubs/pull/1571
QuerySet._result_cache
attribute and _fetch_all()
method by @adamchainz in https://github.com/typeddjango/django-stubs/pull/1505
ModelAdmin.search_help_text
attribute by @adamchainz in https://github.com/typeddjango/django-stubs/pull/1546
EmailBackend.write_message()
method by @adamchainz in https://github.com/typeddjango/django-stubs/pull/1547
ModelAdmin.get_formset_kwargs()
method by @adamchainz in https://github.com/typeddjango/django-stubs/pull/1545
Signal._live_receivers()
method by @adamchainz in https://github.com/typeddjango/django-stubs/pull/1551
SQLCompiler._order_by_pairs()
method by @adamchainz in https://github.com/typeddjango/django-stubs/pull/1586
memcache_key_warnings()
function by @rvanlaar in https://github.com/typeddjango/django-stubs/pull/1562
create_model_instance
incorrect data argument type by @namper in https://github.com/typeddjango/django-stubs/pull/1521
RequestSite.{save,delete}
methods as NoReturn
since they always raise by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1530
SafeExceptionReporterFilter
attributes and removed obsolete CLEANSED_SUBSTITUTE
by @mthuurne in https://github.com/typeddjango/django-stubs/pull/1540
AppConfig.default_auto_field
to attribute instead of method by @mthuurne in https://github.com/typeddjango/django-stubs/pull/1541
default_error_messages
attribute type of base Field
and GenericIPAddressField
classes by @asottile in https://github.com/typeddjango/django-stubs/pull/1538
DatabaseWrapper
attributes by @filbasi in https://github.com/typeddjango/django-stubs/pull/1544
dispatch.dispatcher
by @GabDug in https://github.com/typeddjango/django-stubs/pull/1567
str
field names for Window.order_by()
, allow None
for asc/desc
arguments by @GabDug in https://github.com/typeddjango/django-stubs/pull/1574
django.utils.*
types from stubtest by @GabDug in https://github.com/typeddjango/django-stubs/pull/1575
db.migrations.operations
types from stubtest by @GabDug in https://github.com/typeddjango/django-stubs/pull/1583
StepValueValidator
, fixed argument for SRIDCacheEntry
/EmailValidator
, improved urls.resolvers
types by @GabDug in https://github.com/typeddjango/django-stubs/pull/1589
ForeignKey
queryset filters on un-swapped models by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1495
strict_settings
option, allow runtime fallbacks for custom settings by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1557
KeyError: 'model_bases'
and related errors by @intgr in https://github.com/typeddjango/django-stubs/pull/1563
TypedDatabaseRouter
as database router base class by @intgr in https://github.com/typeddjango/django-stubs/pull/1522
--generate-allowlist
by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1576
ArrayField
by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1558
mypy_extensions
by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1566
flake8
plugins by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1579
Full Changelog: https://github.com/typeddjango/django-stubs/compare/4.2.1...4.2.2
db_comment=
argument on Model fields by @andrlik in https://github.com/typeddjango/django-stubs/pull/1492
core.files.storages
types for Django 4.2 by @Alexerson in https://github.com/typeddjango/django-stubs/pull/1488
StreamingHttpResponse
by @Alexerson in https://github.com/typeddjango/django-stubs/pull/1484
robust
parameter to transaction.on_commit()
by @realsuayip in https://github.com/typeddjango/django-stubs/pull/1469
django.conf
constants Literal
s by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1470
TypedModelMeta
for typing Model inner Meta class. This feature was deferred from the previous version due to a bug. by @intgr in https://github.com/typeddjango/django-stubs/pull/1375, https://github.com/typeddjango/django-stubs/pull/1456
__init__.py
in django_stubs_ext.db by @monosans in https://github.com/typeddjango/django-stubs/pull/1460
cache_page
, cache_control
, sensitive_variables
, sensitive_post_parameters
, condition
, etag
, last_modified
) by @Kostia-K in https://github.com/typeddjango/django-stubs/pull/1465
ManyToManyRawIdWidget
to accept ManyToManyRel
argument by @RyanWalker277 in https://github.com/typeddjango/django-stubs/pull/1447
classonlymethod
decorator declaration by @adamchainz in https://github.com/typeddjango/django-stubs/pull/1494
admin.sites.get_app_list()
by @AkaZecik in https://github.com/typeddjango/django-stubs/pull/1497
lookup_needs_distinct()
function by @AkaZecik in https://github.com/typeddjango/django-stubs/pull/1498
_make_token_with_timestamp()
argument secret
type by @christianbundy in https://github.com/typeddjango/django-stubs/pull/1462
send_mass_email()
argument type to allow None
by @dlesbre in https://github.com/typeddjango/django-stubs/pull/1516
UserCreationForm
generic by @monosans in https://github.com/typeddjango/django-stubs/pull/1518
SessionBase
methods, improved SessionStore.get_model_class()
return type by @realsuayip in https://github.com/typeddjango/django-stubs/pull/1517
__init__.py
with flake8-no-pep420 by @intgr in https://github.com/typeddjango/django-stubs/pull/1461
Full Changelog: https://github.com/typeddjango/django-stubs/compare/4.2.0...4.2.1