Releases: typeddjango/django-stubs
5.1.1
What's Changed
- Add django 5.1 to the test matrix and add its classifier by @foarsitter in #2380
- fix function overload of Library.simple_tag by @asottile in #2390
- Fix resolve_error_handler return type by @ljodal in #2392
- Make
BaseEngine.app_dirname
non-optional by @mthuurne in #2394 - [5.1] Add from_queryset param to
(a)refresh_from_db()
by @jacobtylerwalls in #2402 - Make
from_string()
andget_template()
return backend-specific template by @mthuurne in #2400 - Update type of the
get_session_auth_fallback_hash
method to the correct type by @JaeHyuckSa in #2407 - Fix TypedDictType crash with mypy 1.12.x by @federicobond in #2408
- Remove EOL Python 3.8 and add 3.13 to CI by @sobolevn in #2397
- Treat
QuerySet.alias
likeQuerySet.annotate
by @andersk in #2411 - Fixes #2413 -- update ModelAdmin.log_FOO method signatures by @sergei-maertens in #2414
- Update
db.migrations.serializer
by @JaeHyuckSa in #2421 - Update
django.conf.global_settings
by @JaeHyuckSa in #2420 - Allow
None
onview_on_site
by @nijel in #2419 - Version 5.1.1 release by @flaeppe in #2424
New Contributors
- @foarsitter made their first contribution in #2380
- @sergei-maertens made their first contribution in #2414
- @nijel made their first contribution in #2419
Full Changelog: 5.1.0...5.1.1
5.1.0
Headline changes
- Refactor support for
annotate
to utilisemypy.types.Instance.extra_attrs
by @flaeppe in #2319 - Resolve configured
AUTH_USER_MODEL
with aget_type_analyze_hook
by @flaeppe in #2335
What's Changed
- Fix type hints for
SimpleTestCase
by @flaeppe in #2289 - Check correct model on m2m reverse values/values_list by @flaeppe in #2288
- match Field TypeVar variance in models.fields.related by @asottile in #2292
- try and use named arguments from caller for matching name by @asottile in #2294
- Allow
fields
being anIterable
inbulk_update
by @flaeppe in #2296 - Test usage of
from_queryset
manager as reverse manager by @flaeppe in #2295 - A workaround for #2299 by @sobolevn in #2300
- Run mypy with
--strict
onassert_type
tests by @flaeppe in #2301 - Improve
get_context_object_name
onSingleObjectMixin
andMultipleObjectMixin
by @flaeppe in #2298 - Update pyright to 1.1.374 by @sobolevn in #2305
- Remove
BaseManager.cache
attribute by @flaeppe in #2309 - Loosen bound on
CurrentSiteManager
manager type var by @flaeppe in #2308 - Update build status link for
django-stubs-ext
by @flaeppe in #2310 - Use
Any
forConnectionProxy
attributes by @RealOrangeOne in #2311 - Remove
FieldDoesNotExist
from where it's not present at runtime by @flaeppe in #2313 - Declare
ManyToManyField.description
a_StrOrPromise
by @flaeppe in #2312 - Don't populate a type arg for non generic managers by @flaeppe in #2314
- Fixed bugs with RawQuerySet by @ashm-dev in #2316
- Add Typing for EmailField with Support for String Set and Get Types by @ashm-dev in #2317
- Do
models.Model
adjustments fromget_metaclass_hook
by @flaeppe in #2322 - Bump django from 5.0.7 to 5.0.8 by @sobolevn in #2325
- This PR adds some defaults to stubs with
stubdefaulter
by @sobolevn in #2326 - Add a lot of runtime defaults to stubs with
stubdefaulter
by @sobolevn in #2327 - Fix
tuple[A]
types to betuple[A, ...]
types by @sobolevn in #2328 - Check annotated fields in
<QuerySet>.filter
call by @flaeppe in #2332 - Refactor: Unify plugin check for model type info by @flaeppe in #2286
- Enable
mypy.plugins.proper_plugin
by @flaeppe in #2333 - Use mypy's
make_optional_type
instead of shipping our own by @flaeppe in #2334 - Add arbitrary named arguments to @receiver decorator by @craigds in #2342
- Bump django from 5.0.8 to 5.1 by @Viicos in #2347
- Don't modify return values of manager methods in place, modify a copy instead by @jkaikkosplk in #2345
- [5.1] Add slicing notation to F expressions by @Viicos in #1897
- 5.1: Deprecate CheckConstraint.check by @q0w in #2331
- feat: Add missing stubs by @BradleyKirton in #2348
- Update
utils
by @Viicos in #2352 - Update
contrib.sessions.backends
by @Viicos in #2351 - Update django to 5.1.1 by @sobolevn in #2360
- Allow None return form model Field.formfield() by @adamchainz in #2363
- add cache_name for django 5.1 by @asottile in #2365
- Update Django 4.2 LTS version to 4.2.16 by @intgr in #2369
- Document the release process by @intgr in #2371
- Allow lookups on
.annotate
fields by @sterliakov in #2376 - Break what apparently is a cycle involving custom User model and
QuerySet.as_manager()
by @sterliakov in #2377 - Version 5.1.0 release by @richardebeling in #2374
New Contributors
- @RealOrangeOne made their first contribution in #2311
- @ashm-dev made their first contribution in #2316
- @craigds made their first contribution in #2342
- @jkaikkosplk made their first contribution in #2345
- @BradleyKirton made their first contribution in #2348
- @richardebeling made their first contribution in #2374
Full Changelog: 5.0.4...5.1.0
5.0.4
What's Changed
This is a re-release of django-stubs 5.0.3
with a minor fix:
Full Changelog: 5.0.3...5.0.4
Release notes for version 5.0.3
What's Changed
- Release workflow: publish
django-stubs-ext
beforedjango-stubs
by @flaeppe in #2188 - Migrate
apps/test_config.yml
'assert_type' tests by @flaeppe in #2190 - Add
ManyToManyField.m2m_field_name
andModel._get_pk_val
methods by @YPCrumble in #2177 Lookup
should be a subtype ofExpression
by @mkurnikov in #2199- Update
django.db.models.functions
: allowCombinable
as parameter, addRound
function by @noamkush in #2195 - Add missing
django.core.management.utils
functions by @Viicos in #2200 - Improve
django.middleware
stubs by @Viicos in #2202 - Improve
django.http
stubs by @Viicos in #2201 - Tests: Migrate
db/models/test_constraints.yml
to 'assert_type' tests by @flaeppe in #2204 - Allow any function for admin's
display
andaction
decorators by @flaeppe in #2210 - Remove invalid re-export
django.forms.ChoiceWidget
by @asottile in #2207 - Model._meta.pk is non-None by @asottile in #2218
- update / create defaults are read-only Mapping by @asottile in #2216
- Add missing math.Random database function by @noamkush in #2222
- Make
ReverseManyToOneDescriptor
generic over a model by @flaeppe in #2227 - Extract through table creation to separate method by @flaeppe in #2229
- Do many related manager creation during semantic analysis by @flaeppe in #2231
- Expand CheckRegistry.register as function (#2232) by @jwhitlock in #2233
- don't copy magic or private methods in from_queryset managers by @asottile in #2240
- Make plugin handle explicitly declared reverse descriptors for FKs by @flaeppe in #2230
- Expect a
QuerySet
for multiple defaults inMultipleObjectMixin
by @flaeppe in #2191 - fix handling of explicit
objects
annotation by @asottile in #2241 - Add atomic_blocks to base DB wrapper by @palfrey in #2242
- walk mro for Field set type annotations by @asottile in #2244
- Add
serialized_aliases
parameter tosetup_databases
function indjango.test.utils
by @DongwookKim0823 in #2247 - use field annotations for values_list types by @asottile in #2248
- Improve types of
ConnectionProxy
by @Viicos in #2246 - Add
get_template_tag_modules
function signature todjango.template.backends.django
by @DongwookKim0823 in #2250 - add PlaceholderNode when deferring manager class hook by @asottile in #2228
- Update function signatures for
django.db.models.sql.Query
class by @DongwookKim0823 in #2253 - Update
admin.sites._ViewType
bound to allowStreamingHttpResponse
by @savanto in #2256 - Add
Options._get_fields
by @Viicos in #2254 - Support inheriting ManyToManyField from an abstract model by @flaeppe in #2260
- Allow single generic param for Field in ForeignKey by @rafonseca in #2261
- Refactor: Unify plugin check for model type info by @flaeppe in #2263
- add
Path
type argument to tuple returned byget_app_template_dirs
by @joshuadavidthomas in #2266 - add missing type argument to
Paginator
by @joshuadavidthomas in #2271 - Update mypy to 1.11.0 by @sobolevn in #2269
- Check calls to filtering manager methods involving
ManyToManyField
by @flaeppe in #2275 - Prepare for a release
5.0.3
by @flaeppe in #2274 - lookup manager type via mro by @asottile in #2276
- Check model fields on filtering methods of queryset types by @flaeppe in #2277
- fill QuerySet generics using the manager's model type by @asottile in #2281
- convert as_manager hooks to base class hook by @asottile in #2282
New Contributors
- @YPCrumble made their first contribution in #2177
- @jwhitlock made their first contribution in #2233
- @DongwookKim0823 made their first contribution in #2247
- @savanto made their first contribution in #2256
- @rafonseca made their first contribution in #2261
- @joshuadavidthomas made their first contribution in #2266
Full Changelog: 5.0.2...5.0.3
5.0.3
What's Changed
- Release workflow: publish
django-stubs-ext
beforedjango-stubs
by @flaeppe in #2188 - Migrate
apps/test_config.yml
'assert_type' tests by @flaeppe in #2190 - Add
ManyToManyField.m2m_field_name
andModel._get_pk_val
methods by @YPCrumble in #2177 Lookup
should be a subtype ofExpression
by @mkurnikov in #2199- Update
django.db.models.functions
: allowCombinable
as parameter, addRound
function by @noamkush in #2195 - Add missing
django.core.management.utils
functions by @Viicos in #2200 - Improve
django.middleware
stubs by @Viicos in #2202 - Improve
django.http
stubs by @Viicos in #2201 - Tests: Migrate
db/models/test_constraints.yml
to 'assert_type' tests by @flaeppe in #2204 - Allow any function for admin's
display
andaction
decorators by @flaeppe in #2210 - Remove invalid re-export
django.forms.ChoiceWidget
by @asottile in #2207 - Model._meta.pk is non-None by @asottile in #2218
- update / create defaults are read-only Mapping by @asottile in #2216
- Add missing math.Random database function by @noamkush in #2222
- Make
ReverseManyToOneDescriptor
generic over a model by @flaeppe in #2227 - Extract through table creation to separate method by @flaeppe in #2229
- Do many related manager creation during semantic analysis by @flaeppe in #2231
- Expand CheckRegistry.register as function (#2232) by @jwhitlock in #2233
- don't copy magic or private methods in from_queryset managers by @asottile in #2240
- Make plugin handle explicitly declared reverse descriptors for FKs by @flaeppe in #2230
- Expect a
QuerySet
for multiple defaults inMultipleObjectMixin
by @flaeppe in #2191 - fix handling of explicit
objects
annotation by @asottile in #2241 - Add atomic_blocks to base DB wrapper by @palfrey in #2242
- walk mro for Field set type annotations by @asottile in #2244
- Add
serialized_aliases
parameter tosetup_databases
function indjango.test.utils
by @DongwookKim0823 in #2247 - use field annotations for values_list types by @asottile in #2248
- Improve types of
ConnectionProxy
by @Viicos in #2246 - Add
get_template_tag_modules
function signature todjango.template.backends.django
by @DongwookKim0823 in #2250 - add PlaceholderNode when deferring manager class hook by @asottile in #2228
- Update function signatures for
django.db.models.sql.Query
class by @DongwookKim0823 in #2253 - Update
admin.sites._ViewType
bound to allowStreamingHttpResponse
by @savanto in #2256 - Add
Options._get_fields
by @Viicos in #2254 - Support inheriting ManyToManyField from an abstract model by @flaeppe in #2260
- Allow single generic param for Field in ForeignKey by @rafonseca in #2261
- Refactor: Unify plugin check for model type info by @flaeppe in #2263
- add
Path
type argument to tuple returned byget_app_template_dirs
by @joshuadavidthomas in #2266 - add missing type argument to
Paginator
by @joshuadavidthomas in #2271 - Update mypy to 1.11.0 by @sobolevn in #2269
- Check calls to filtering manager methods involving
ManyToManyField
by @flaeppe in #2275 - Prepare for a release
5.0.3
by @flaeppe in #2274 - lookup manager type via mro by @asottile in #2276
- Check model fields on filtering methods of queryset types by @flaeppe in #2277
- fill QuerySet generics using the manager's model type by @asottile in #2281
- convert as_manager hooks to base class hook by @asottile in #2282
New Contributors
- @YPCrumble made their first contribution in #2177
- @jwhitlock made their first contribution in #2233
- @DongwookKim0823 made their first contribution in #2247
- @savanto made their first contribution in #2256
- @rafonseca made their first contribution in #2261
- @joshuadavidthomas made their first contribution in #2266
Full Changelog: 5.0.2...5.0.3
5.0.2
What's Changed
This is a re-release of django-stubs 5.0.1
with a minor fix:
Full Changelog: 5.0.1...5.0.2
Release notes for version 5.0.1
Headline changes
-
Support for Django 4.1 have been dropped by @sobolevn in #2133
-
A new extra,
django-stubs[oracle]
, was added by @sobolevn in #2131 -
Remove QuerySet alias hacks via PEP 696 TypeVar defaults. All usages of
QuerySetAny
andValuesQuerySet
can now be replaced with simpleQuerySet
by @intgr in #2104
What's Changed
- 5.0: Update
django.contrib.admin.views
anddjango.forms.forms.Form
metaclass by @sudosubin in #2079 - Fix IndexError for custom queryset managers by @meshy in #1913
- 5.0: Update
django.db.models.lookups
by @saJaeHyukc in #2103 - 5.0: Update
django.db.backends.utils
by @saJaeHyukc in #2102 - 5.0: Update
django.forms.field.Field
by @saJaeHyukc in #2107 - 5.0: Update
django.contrib.messages.storage.cookie
by @saJaeHyukc in #2106 - Tests: Add test case for settings import cycle by @intgr in #2098
- 5.0: Update
django.db.models.expressions
by @saJaeHyukc in #2110 - 5.0: Update
django.contrib.auth.backends
by @saJaeHyukc in #2111 - 5.0: Update
django.contrib.auth.base_user
by @saJaeHyukc in #2113 - 5.0: Update
django.db.migrations.serializer
by @saJaeHyukc in #2109 - 5.0: Update
django.db.backends.base.features.BaseDatabaseFeature
by @saJaeHyukc in #2099 - 5.0: Update
django.db.backends.base.operations.BaseDatabaseOperations
by @saJaeHyukc in #2100 - Fix annotation for
request.auser
by @bshelkhonov in #2108 - 5.0: Update
django.contrib.gis.admin.widgets
anddjango.contrib.gis.admin.options
by @saJaeHyukc in #2116 - 5.0: Update
django.forms.boundfield
anddjango.forms.utils
by @saJaeHyukc in #2118 - Prepare django-stubs-ext for QuerySet typevar refactor by @intgr in #2117
BaseBackend.get_user
: Relaxuser_id
param type by @tony in #2121- 5.0: Update
django.forms.renderers
by @saJaeHyukc in #2119 - 5.0: Update
django.forms.forms
by @saJaeHyukc in #2122 - 5.0: Update
django.contrib.gis.db.backends.sqatialite.schema
by @saJaeHyukc in #2123 - Improve types in DB backend
schema
modules by @saJaeHyukc in #2124 - 5.0: Update
django.contrib.messages.test
by @saJaeHyukc in #2126 - [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in #2129
- More pre-commit checks by @sobolevn in #2132
- Bump django from 5.0.5 to 5.0.6 by @dependabot in #2135
- 5.0: Update
django.contrib.contenttypes.prefetch
by @saJaeHyukc in #2115 - 5.0: Update
django.contrib.admin.widgets
by @saJaeHyukc in #2105 - 5.0: Update
django.contrib.contenttypes.fields.GenericForeignKey
methods by @saJaeHyukc in #2137 - Relax typing of
backend
indjango.contrib.auth
(ModelBackend
->BaseBackend
) by @tony in #2141 - fix: UserAdmin accepts AbstractUser by @vadimshvetsov in #2139
- 4.2.8: Update
Query.resolve_lookup_value()
parameters by @saJaeHyukc in #2136 - Increase priority of mypy internal Django settings import by @intgr in #2127
- Fix 'Import cycle from Django settings module' errors function context by @intgr in #2142
- Adjust priority of Django settings import again by @intgr in #2143
- 5.0: Update
django.forms.models
by @saJaeHyukc in #2146 - Add typing of
django.db.migrations.autodetector
by @saJaeHyukc in #2149 - 5.0: Update
django.db.models.enums
by @saJaeHyukc in #2148 - 5.0: Update
django.forms.widgets
by @saJaeHyukc in #2147 - Add GitHub actions release workflow for
django-stubs-ext
by @flaeppe in #2150 - 5.0: Update
django.db.models.field.related
by @saJaeHyukc in #2151 - Bump pre-commit from 3.7.0 to 3.7.1 by @dependabot in #2155
- Fix
TextChoices.__new__()
parameter type by @mvaled in #2156 - Ensure ManyToManyField related managers supports renamed imports by @flaeppe in #2153
- 5.0: Update
django.contrib.gis.db.backends.postgis.operations
by @saJaeHyukc in #2138 - 5.0: Update
django.db.models.fields.reverse_related
by @saJaeHyukc in #2158 - 5.0: Update
django.db.models.field
: addgenerated
attribute to model fields by @saJaeHyukc in #2152 - 5.0: Update
django.db.models.sql.datastructures
by @saJaeHyukc in #2159 - 5.0: Update
django.db.models.query
by @saJaeHyukc in #2160 - [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in #2161
- 5.0: Update
django.db.models.sql.compiler
by @saJaeHyukc in #2166 - 5.0: Update
django.db.models.functions.datetime
by @saJaeHyukc in #2167 - 5.0: Update
django.forms.formsets
by @saJaeHyukc in #2145 - 5.0: Update
django.db.models.query_utils
by @saJaeHyukc in #2165 - Bump pytest from 8.2.0 to 8.2.1 by @dependabot in #2169
- 5.0: Update
django.db.models.functions.datetime.Now
by @saJaeHyukc in #2173 - 5.0: Update
django.db.models.sql.query.Query
by @saJaeHyukc in #2172 - 5.0: Update
django.db.models.field.related_descriptors
by @saJaeHyukc in #2157 - 5.0: Update django.db.models.constraints.UniqueConstraint by @steve148 in #2175
- 5.0: Update
django.db.models.expressions
by @saJaeHyukc in #2176 - Add
BaseConstraint.get_violation_error_message()
by @q0w in #2178 - Fix signature of Choices member creation, add
assert_type
test cases, runpyright
by @Viicos in #2162 AbstractBaseSession
: Use model fields for subclassed cases by @tony in #2180- Migrate 'test_conf.yml' to 'assert_type' tests by @flaeppe in #2182
- Don't crash when inspecting classes loaded from cache by @flaeppe in #2185
- Formset get_queryset() returns QuerySet by @MrkGrgsn in #2174
- Prepare for a release
5.0.1
by @flaeppe in #2183
New Contributors
- @meshy made their first contribution in #1913
- @bshelkhonov made their first contribution in #2108
- @vadimshvetsov made their first contribution in #2139
- @mvaled made their first contribution in #2156
- @steve148 made their first contribution in #2175
Full Changelog: 5.0.0...5.0.1
5.0.1
Headline changes
-
Support for Django 4.1 have been dropped by @sobolevn in #2133
-
A new extra,
django-stubs[oracle]
, was added by @sobolevn in #2131 -
Remove QuerySet alias hacks via PEP 696 TypeVar defaults. All usages of
QuerySetAny
andValuesQuerySet
can now be replaced with simpleQuerySet
by @intgr in #2104
What's Changed
- 5.0: Update
django.contrib.admin.views
anddjango.forms.forms.Form
metaclass by @sudosubin in #2079 - Fix IndexError for custom queryset managers by @meshy in #1913
- 5.0: Update
django.db.models.lookups
by @saJaeHyukc in #2103 - 5.0: Update
django.db.backends.utils
by @saJaeHyukc in #2102 - 5.0: Update
django.forms.field.Field
by @saJaeHyukc in #2107 - 5.0: Update
django.contrib.messages.storage.cookie
by @saJaeHyukc in #2106 - Tests: Add test case for settings import cycle by @intgr in #2098
- 5.0: Update
django.db.models.expressions
by @saJaeHyukc in #2110 - 5.0: Update
django.contrib.auth.backends
by @saJaeHyukc in #2111 - 5.0: Update
django.contrib.auth.base_user
by @saJaeHyukc in #2113 - 5.0: Update
django.db.migrations.serializer
by @saJaeHyukc in #2109 - 5.0: Update
django.db.backends.base.features.BaseDatabaseFeature
by @saJaeHyukc in #2099 - 5.0: Update
django.db.backends.base.operations.BaseDatabaseOperations
by @saJaeHyukc in #2100 - Fix annotation for
request.auser
by @bshelkhonov in #2108 - 5.0: Update
django.contrib.gis.admin.widgets
anddjango.contrib.gis.admin.options
by @saJaeHyukc in #2116 - 5.0: Update
django.forms.boundfield
anddjango.forms.utils
by @saJaeHyukc in #2118 - Prepare django-stubs-ext for QuerySet typevar refactor by @intgr in #2117
BaseBackend.get_user
: Relaxuser_id
param type by @tony in #2121- 5.0: Update
django.forms.renderers
by @saJaeHyukc in #2119 - 5.0: Update
django.forms.forms
by @saJaeHyukc in #2122 - 5.0: Update
django.contrib.gis.db.backends.sqatialite.schema
by @saJaeHyukc in #2123 - Improve types in DB backend
schema
modules by @saJaeHyukc in #2124 - 5.0: Update
django.contrib.messages.test
by @saJaeHyukc in #2126 - [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in #2129
- More pre-commit checks by @sobolevn in #2132
- Bump django from 5.0.5 to 5.0.6 by @dependabot in #2135
- 5.0: Update
django.contrib.contenttypes.prefetch
by @saJaeHyukc in #2115 - 5.0: Update
django.contrib.admin.widgets
by @saJaeHyukc in #2105 - 5.0: Update
django.contrib.contenttypes.fields.GenericForeignKey
methods by @saJaeHyukc in #2137 - Relax typing of
backend
indjango.contrib.auth
(ModelBackend
->BaseBackend
) by @tony in #2141 - fix: UserAdmin accepts AbstractUser by @vadimshvetsov in #2139
- 4.2.8: Update
Query.resolve_lookup_value()
parameters by @saJaeHyukc in #2136 - Increase priority of mypy internal Django settings import by @intgr in #2127
- Fix 'Import cycle from Django settings module' errors function context by @intgr in #2142
- Adjust priority of Django settings import again by @intgr in #2143
- 5.0: Update
django.forms.models
by @saJaeHyukc in #2146 - Add typing of
django.db.migrations.autodetector
by @saJaeHyukc in #2149 - 5.0: Update
django.db.models.enums
by @saJaeHyukc in #2148 - 5.0: Update
django.forms.widgets
by @saJaeHyukc in #2147 - Add GitHub actions release workflow for
django-stubs-ext
by @flaeppe in #2150 - 5.0: Update
django.db.models.field.related
by @saJaeHyukc in #2151 - Bump pre-commit from 3.7.0 to 3.7.1 by @dependabot in #2155
- Fix
TextChoices.__new__()
parameter type by @mvaled in #2156 - Ensure ManyToManyField related managers supports renamed imports by @flaeppe in #2153
- 5.0: Update
django.contrib.gis.db.backends.postgis.operations
by @saJaeHyukc in #2138 - 5.0: Update
django.db.models.fields.reverse_related
by @saJaeHyukc in #2158 - 5.0: Update
django.db.models.field
: addgenerated
attribute to model fields by @saJaeHyukc in #2152 - 5.0: Update
django.db.models.sql.datastructures
by @saJaeHyukc in #2159 - 5.0: Update
django.db.models.query
by @saJaeHyukc in #2160 - [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in #2161
- 5.0: Update
django.db.models.sql.compiler
by @saJaeHyukc in #2166 - 5.0: Update
django.db.models.functions.datetime
by @saJaeHyukc in #2167 - 5.0: Update
django.forms.formsets
by @saJaeHyukc in #2145 - 5.0: Update
django.db.models.query_utils
by @saJaeHyukc in #2165 - Bump pytest from 8.2.0 to 8.2.1 by @dependabot in #2169
- 5.0: Update
django.db.models.functions.datetime.Now
by @saJaeHyukc in #2173 - 5.0: Update
django.db.models.sql.query.Query
by @saJaeHyukc in #2172 - 5.0: Update
django.db.models.field.related_descriptors
by @saJaeHyukc in #2157 - 5.0: Update django.db.models.constraints.UniqueConstraint by @steve148 in #2175
- 5.0: Update
django.db.models.expressions
by @saJaeHyukc in #2176 - Add
BaseConstraint.get_violation_error_message()
by @q0w in #2178 - Fix signature of Choices member creation, add
assert_type
test cases, runpyright
by @Viicos in #2162 AbstractBaseSession
: Use model fields for subclassed cases by @tony in #2180- Migrate 'test_conf.yml' to 'assert_type' tests by @flaeppe in #2182
- Don't crash when inspecting classes loaded from cache by @flaeppe in #2185
- Formset get_queryset() returns QuerySet by @MrkGrgsn in #2174
- Prepare for a release
5.0.1
by @flaeppe in #2183
New Contributors
- @meshy made their first contribution in #1913
- @bshelkhonov made their first contribution in #2108
- @vadimshvetsov made their first contribution in #2139
- @mvaled made their first contribution in #2156
- @steve148 made their first contribution in #2175
Full Changelog: 5.0.0...5.0.1
5.0.0
Announcements
QuerySet
class no longer derives fromCollection
. If you run into errors likeincompatible type "_QuerySet[User, User]"; expected "Collection[User]"
, please read this announcement.
Headline changes
- Remove incorrect
Collection
base class and__contains__
method fromQuerySet
by @fidoriel in #1925 - Pyright joins the workflow in an advisory capacity by @jorenham in #2019
- feat: Allow setting django_settings_module from env by @armanckeser in #2021
- Add
ManyRelatedManager.through
attribute and generic type parameter by @flaeppe in #2026
What's Changed
- Make
StrPromise
not inherit fromSequence[str]
by @intgr in #1841 - Update and prepare for Django 5.0 by @intgr in #1859
- Ensure mypy plugin processes inherited many to many fields by @flaeppe in #1864
- Include ModelBase subclasses in plugin base class hook condition by @flaeppe in #1863
- [5.0] Added many new a-prefixed asynchronous methods by @bigfootjon in #1741
- Remove section regarding custom queryset methods from README by @flaeppe in #1865
- Fix type of
AppConfig.models_module
by @Viicos in #1866 - Allow
None
in settingsMIGRATION_MODULES
dict values by @asottile in #1871 - Add type hints for
JSONField.from_db_value
by @flaeppe in #1879 - Fix/pyright unknown by @dephiros in #1873
- Fix type hints of
converters
inurls.resolvers
by @Viicos in #1892 - Update mypy to 1.8.0 by @sobolevn in #1885
- Add
@type_check_only
to all Protocols and known stubs-only classes by @intgr in #1894 - Fix types for UniqueConstraint instantiation by @flaeppe in #1880
- Add
ModuleType
as a possible type toURLResolver.urlconf_name
by @Viicos in #1891 - Fix type hint of
URLPattern.default_args
by @Viicos in #1895 - Update ruff and silence
PYI046
by @sobolevn in #1907 - Use PEP 570 syntax by @Viicos in #1908
- Fix readme settings example by @Viicos in #1910
- Fix type hint of
EmailBackend.ssl_keyfile
andEmailBackend.ssl_certfile
by @Viicos in #1911 - Add type of
django.VERSION
by @Viicos in #1916 - Added
CommandParser
tocommands.__init__
by @jamesbraza in #1927 - [5.0] add
assume_scheme
to forms.URLField by @asottile in #1929 - Fix return type of
BaseModelAdmin.formfield_for_dbfield
by @Viicos in #1934 - Revert
pre-commit==3.6.1
by @sobolevn in #1936 - Fix type hint of
Response.set_cookie.max_age
by @Viicos in #1941 - 5.0: Add ChoicesType by @q0w in #1942
- Add through_defaults for RelatedManager methods by @mfosterw in #1943
- Update type hints of
core.signing
by @Viicos in #1945 - [5.0] Update
core.validators
by @Viicos in #1947 - [5.0] Update
core.paginator
by @Viicos in #1946 - Generic
forms.ModelChoiceField
by @UnknownPlatypus in #1889 - Support processing of other relations and fields when one is broken by @flaeppe in #1877
- Allowing
set
inmodel_to_dict
'sexclude
by @jamesbraza in #1952 - [5.0] Add django.db.models.GeneratedField by @palfrey in #1944
- Fix type hint of
BaseEngine.template_dirs
by @Viicos in #1954 - Update type hints of contrib.auth.hashers by @yhay81 in #1955
- deps: Upgrade pre-commit for newer versions of python by @delfick in #1961
- 5.0: Add auth.middleware.auser by @q0w in #1966
- 5.0: Add ModelAdmin.show_facets by @q0w in #1967
- ruff: Fix config warnings by @q0w in #1964
- 5.0: Add BaseConstraint.violation_error_code by @q0w in #1969
- 5.0: Add Signal.asend and Signal.asend_robust by @q0w in #1965
- 5.0: Add QuerySet.(a)update_or_create new create_defaults arg by @q0w in #1970
- 5.0: Add AdminSite.get_log_entries by @q0w in #1963
- 5.0: Add gis ClosestPoint by @q0w in #1968
- 5.0: Rename save_existing arg instance to obj by @q0w in #1971
- 5.0: Remove admin.helpers.checkbox by @q0w in #1972
- 5.0: Change annotation_select_mask from set[str] to list[str] by @q0w in #1973
- fixup: Pass violation_error_code to init by @q0w in #1975
- Avoid returning None from get_field_related_model_cls by @SingingTree in #1956
- 5.0: Pass positional args name and violation_error_message to BaseConstraint by @q0w in #1974
- 5.0: Remove pytz support by @q0w in #1980
- 5.0: Remove global setting USE_L10N by @q0w in #1979
- 5.0: Remove OSMGeoAdmin, GeoModelAdmin by @q0w in #1981
- 5.0: Remove extra_tests arg for DiscoverRunner.build_suite/run_tests by @q0w in #1978
- 5.0: Remove django.utils baseconv and datetime_safe modules by @q0w in #1977
- 5.0: Add request arg to ModelAdmin.lookup_allowed by @q0w in #1976
- Add URL converter protocol type by @adamchainz in #1984
- Fix type annotation for RegisterLookupMixin.class_lookups by @avoronov-box in #1962
- Update django to 5.0.3 by @sobolevn in #1990
- Remove some deprecated Django 3.x APIs by @sobolevn in #1991
- Fix BaseModelAdmin.view_on_site annotation by @cuu508 in #1993
- Allow immutable
extra_context
onTemplateView
s by @samueljsb in #1994 - Add BoundField.html() by @pelme in #1999
- Allow timedelta type for session.set_expiry() argument by @mlazar-endear in #2001
- Bump
pytest-mypy-plugins
to 3.1.1 by @sobolevn in #2003 - Update mypy, add a bit more metadata by @sobolevn in #1997
- 5.0: Update
django.contrib.auth
by @ngnpope in #2009 - 5.0: Update
django.conf
by @ngnpope in #2008 - 5.0: Update
django.views
by @ngnpope in #2007 - 5.0: Update
django.test
by @ngnpope in #2005 - 5.0: Update
django.utils
by @ngnpope in #2006 - Specify d.c.serializers.base.DeserializedObject.object type by @j00bar in #2010
- Clean the cache on each run of
stubtest
by @sobolevn in #2015 - Keep abstract Django models internally in the plugin by @flaeppe in #2017
- Add GitHub actions release workflow by @flaeppe in #1950
- Adding missing
Q
methods:check()
,flatten()
by @Alexerson in #1899 - Improve types in
utils.termcolors
by @Viicos in #1901 - Set the calculated metaclass when creating type info in the plugin by @flaeppe in https://github.c...
4.2.7
Headline changes
- mypy 1.7: Recommended mypy version updated to 1.7.x
- Improved type inference for
ManyToManyField
andModel.<manytomany>.through
- If you previously imported
RelatedManager
orManyRelatedManager
, update those to django-stubs-ext:
from django_stubs_ext.db.models.manager import ManyRelatedManager, RelatedManager
- It's now allowed to override Django's
@cached_property
properties with class variables or@property
properties. - Even though Django 5.0 was released yesterday, this version does not yet include any changes specific to Django 5.0.
Plugin improvements
- Improved
ManyToManyDescriptor
and fixedModel.<manytomany>.through
typing by @flaeppe in #1805 - Fixed
Self
-typed custom queryset methods to be compatible withQuerySet
by @moranabadie in #1852
django-stubs-ext
- django-stubs-ext: Export
RelatedManager
,ManyRelatedManager
stub-only classes by @intgr in #1834 - Updated
TypedModelMeta
ordering
attribute to allowOrderBy
objects by @HansAarneLiblik in #1847
Stubs fixes
- Added missing
search_help_text=
parameter toChangeList.__init__()
by @quinox in #1801 - Allow additional types for SQL parameters in
migrations.RunSQL()
by @UnknownPlatypus in #1803 - Allow custom Form class in
SuccessMessageMixin.form_valid()
by @SukiCZ in #1812 - Fixed
db_comment=
parameter position fordjango.db.models.Field.__init__()
by @flaeppe in #1815 - Added missing
RelatedField.__init__()
method and removedForeignObject.__init__(db_constraint=)
parameter in Field constructors by @flaeppe in #1816 - Fixed argument types of
assertNumQueries()
andassertQuerySetEqual()
by @flaeppe in #1823 - Fixed
get_deleted_objects()
return fromlist[Model]
->list[str]
by @golgor in #1825 - Removed incorrect
django.db.models
re-exports by @intgr in #1835 - Fixed
TemplateResponse.cookies
attribute andSimpleCookie
type by @apollo13 in #1702
Stubs improvements
- Added stubs for
django.contrib.postgres.expressions
by @flaeppe in #1765 - Improved hints of
django.contrib.gis.gdal.libgdal
by @flaeppe in #1811 - Simulate
@deconstructible
as a mixin class by @flaeppe in #1818 - Improved types for
django.db.models.enums.*
modules by @flaeppe in #1819 - Added
BaseExpression.contains_subquery()
method (update to Django 4.2.7) by @intgr in #1827 - Improved types for multiple methods of
QuerySet
by @flaeppe in #1822 - Improved
Collector
andNestedObjects
attributes, methods by @intgr in #1826 - Added
django.db.models.functions.MD5()
database function by @kevinmarsh in #1830 - Constrained multiple
BaseModelAdmin
attributes to be either list or tuple by @flaeppe in #1832 - Constrained multiple
BaseModelAdmin
methods to return either list or tuple by @flaeppe in #1833 - Accurately infer
capfirst()
None
return by @intgr in #1842 - Various improvements in
django.core.management.commands
modules by @UnknownPlatypus in #1829 - Added
Model._do_update()
method signature by @pfouque in #1854
Stubs improvements: @cached_property
- Reuse
functools.cached_property
definition instead of defining our own by @intgr in #1771 - Updated
@property
attributes to@cached_property
part 1 by @UnknownPlatypus in #1761 - Updated
@property
attributes to@cached_property
part 2 by @UnknownPlatypus in #1768 - Updated Expression classes
output_field
to@cached_property
orClassVar
and improves type by @UnknownPlatypus in #1769
Housekeeping
- Moved plugin generated
<Model>_RelatedManager
entries to allowlist by @flaeppe in #1806 - Moved
RelatedManager
todjango.db.models.fields.related_descriptors
by @flaeppe in #1814 - Restored
RelatedManager
,ManyRelatedManager
to inherit fromManager
notBaseManager
by @intgr in #1843 - Upgraded to mypy 1.7.0 by @intgr in #1837
- Unify plugin check for model type info by @flaeppe in #1853
- Version 4.2.7 release (django-stubs, django-stubs-ext) by @intgr in #1856
New Contributors
- @SukiCZ made their first contribution in #1812
- @golgor made their first contribution in #1825
- @HansAarneLiblik made their first contribution in #1847
- @apollo13 made their first contribution in #1702
- @pfouque made their first contribution in #1854
Full Changelog: 4.2.6...4.2.7
4.2.6
Headline changes
-
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 extradjango-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.
Plugin fixes
- Fixed
as_manager()
andfrom_queryset()
when combined withSelf
types (#1788) by @moranabadie in #1789 - Fix IndexError crash when using
from_queryset()
of custom Manager subclass by @moranabadie in #1786 - Revert "Use
parse_bool
implementation from mypy" by @intgr in #1792
(Turns out this was not necessary and will be reverted)
Stubs fixes
- Fixed
Field.formfield()
,GeometryField.formfield()
method arguments by @brianhelba in #1778
Stubs improvements
- Various improvements in
django.core.management
modules by @UnknownPlatypus in #1787 - Various improvments in
django.db.backend.base
modules by @UnknownPlatypus in #1791
Housekeeping
- Drop hard dependency on mypy by @intgr in #1782
- Version 4.2.6 release (django-stubs only) by @intgr in #1794
Full Changelog: 4.2.5...4.2.6
4.2.5
Headline changes
-
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 extradjango-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
Stubs fixes
- Made
default_storage
produce aStorage
object by @brianhelba in #1665 - Fixed wrong type hints for
SyndicationFeed
methods by @WhyNotHugo in #1705 - Fixed variance of
Migration.operations
attribute by @asottile in #1707 - Fixed variance of all
Migration
list attributes by @brianhelba in #1710 - Adjust
bases=
parameter inCreateModel
migration op to allow for mixins by @asottile in #1708 - Fixed
_Composable
protocol for compatibility withpsycopg2-stubs
change by @andersk in #1714 - Various fixes and improvements in
django.views
modules by @GabDug in #1716 - Removed
null
andvalidators
arguments fromManyToManyField.__init__
by @flaeppe in #1720 - Various fixes and improvements in
django.test
modules by @UnknownPlatypus in #1752 - Fixed
BaseModelForm
,ErrorList
,ErrorDict
constructorrenderer=
parameter by @GabDug in #1690
Stubs improvements
- Annotated return value of all
deconstruct
methods by @brianhelba in #1695 - Added missing arguments to
SQLCompiler
methods by @ashm-tech in #1689 - Added missing
max_length
attribute toforms.FileField
by @GabDug in #1715 - Added missing type arguments to various generic classes by @GabDug in #1717
- Added missing
Layer.num_feat
attribute (GeoDjango) by @niconoe in #1722 - Specify
AbstractBaseUser.REQUIRED_FIELDS
asClassVar
by @WhyNotHugo in #1737 - Improve
fields.Field.formfield()
method by @WhyNotHugo in #1739 - Added
ModelStateFieldsCacheDescriptor.__get__
method by @asottile in #1743 - Update
Model._meta
toClassVar[Options[Self]]
by @flaeppe in #1732 - Improved
django.test.signals
types by @UnknownPlatypus in #1751 - Updated Django to 4.2.6 and updated stubs by @sobolevn in #1757
- Require 1 callable argument for
@cached_property
decorated method by @flaeppe in #1766 - Allow
psycopg2.sql.SQL
inQuerySet.raw()
by @flaeppe in #1767 - Added missing stubs in
django.middleware.csrf
module by @UnknownPlatypus in #1770 - Various improvements in
django.core.cache
modules by @UnknownPlatypus in #1774 - Improved
Field.formfield()
,GeometryField.formfield()
methods by @brianhelba in #1724 - Fixed query
F.resolve_expression()
return type by @schinckel in #1659
Plugin improvements
- Resolve dynamic
Manager
methods through manager MRO by @flaeppe in #1701 - Use
functools.cached_property
instead of Django's in mypy plugin by @flaeppe in #1721 - Improved hints for
ReverseOneToOneDescriptor
and start using it by @flaeppe in #1733 - Add better support for
ManyToManyField
'sthrough
model by @flaeppe in #1719 - Resolve any
settings.AUTH_USER_MODEL
used asto=
in relation by @flaeppe in #1746 - Added missing
_default_manager
symbol to generatedthrough
model by @flaeppe in #1745
Plugin crash fixes
- Gracefully handle unwanted types when creating fallback managers by @flaeppe in #1728
Fixes someAssertionError
crashes. - Handle mismatching types in queryset method resolving gracefully by @flaeppe in #1727
Fixes someAssertionError
crashes. - Fixed crash on bad arguments for model relationship fields by @flaeppe in #1735
Fixes someValueError
crashes.
Documentation
- Fixed link to
django_stubs_ext
by @tony in #1747 & #1748 - Add version 4.2.4 to version compatibility table by @intgr in #1758
Housekeeping
- Removed a bunch of unused code by @flaeppe in #1687
- Removed redefinition of inherited
deconstruct
methods. by @brianhelba in #1693 & #1694 - Use
parse_bool
implementation from mypy by @flaeppe in #1703 - Specify error codes in
# type: ignore
comments for plugin code by @flaeppe in #1726 - Specify error codes in
# type: ignore
comments in stubs files by @UnknownPlatypus in #1734 - CI: Enable testing with Python 3.12 by @intgr in #1759
- Bump mypy from 1.5.1 to 1.6.0 by @dependabot in #1764
- Tests: Add mypy error codes to typecheck by @UnknownPlatypus in #1773
- chore: Migrate from flake8 to ruff by @GabDug in #1718
- Update black version by @sobolevn in #1776
- Added test to verify that
Manager.from_queryset()
handles invalid argument types by @flaeppe in #1731 - Version 4.2.5 release (django-stubs, django-stubs-ext) by @intgr in #1777
New Contributors
- @ashm-tech made their first contribution in #1689
- @WhyNotHugo made their first contribution in #1705
- @niconoe made their first contribution in #1722
- @schinckel made their first contribution in #1659
Full Changelog: 4.2.4...4.2.5