This version add stubs coverage to all known Django 6.0 functionality. If you find anything missing, please open an issue.
Besides Django 6.0 updates, there is an even larger number of other improvements.
Many thanks to everyone who helped out, the amount of contributions has been amazing!
⚠️ Known issues
There is a crash bug in the mypy plugin, when checking code that uses QuerySet.order_by() with abstract models. Please follow #3184
Django 6.0 stubs updates
- Add Model.NotUpdated & ObjectNotUpdated exceptions by @intgr in #2940
- Add stubs for built-in CSP support by @federicobond in #2931
- Add
databases=parameter tocheck_generic_foreign_keys,check_model_name_lengthsby @Tosinibikunle in #2951 - Add stubs for django.db.models.StringAgg and Aggregate order_by fields by @federicobond in #2960
- Add stubs for django.contrib.postgres.search.Lexeme and CombinedLexeme by @federicobond in #2961
- Update ADMINS and MANAGERS setting type by @federicobond in #2965
- Require kwargs for optional parameters in mail functions by @federicobond in #2966
- Add hints support to postgres extension classes by @federicobond in #2972
- Fix missing stubs for
__del__methods by @UnknownPlatypus in #2974 - Require kwargs for optional parameters in EmailMessage by @federicobond in #2975
- Support passing MIMEPart object to EmailMessage.attach by @federicobond in #2976
- Add Django Tasks framework by @federicobond in #2967
- Add
SetPasswordMixin.__class_getitem__by @sobolevn in #2985 - Remove useless decorators from
main/django/contrib/auth/admin.pyby @sobolevn in #2986 - Remove default value from check functions by @brianhelba in #2993
- Allow plain
ForminDeleteViewtype parameters by @emmanuel-ferdman in #2996 - Fix
FileFieldandImageFieldinstance access return types by @emmanuel-ferdman in #2997 - Fix window function parameter types by @emmanuel-ferdman in #2999
- Add support for AnyValue aggregate by @federicobond in #3002
- Add missing database backend feature flags by @emmanuel-ferdman in #3005
- Add TASKS setting by @federicobond in #3006
- Add async pagination support by @emmanuel-ferdman in #3009
- Add template partials support by @emmanuel-ferdman in #3010
- Update deprecation module by @emmanuel-ferdman in #3013
- Add missing migration serializers by @emmanuel-ferdman in #3016
- Add system checks support by @emmanuel-ferdman in #3019
- Add missing mail module signatures by @emmanuel-ferdman in #3023
- Add auth module stubs by @emmanuel-ferdman in #3024
- Add http utilities support by @emmanuel-ferdman in #3025
- Add form constraint validation support by @emmanuel-ferdman in #3026
- Add test module stubs by @emmanuel-ferdman in #3027
- Add contenttypes module stubs by @emmanuel-ferdman in #3029
- Add missing migration operation stubs by @emmanuel-ferdman in #3032
- Add postgres module stubs by @emmanuel-ferdman in #3037
- Add utils module stubs by @emmanuel-ferdman in #3043
- Update conf settings stubs by @emmanuel-ferdman in #3045
- Add tasks module stubs by @emmanuel-ferdman in #3044
- Update admin module stubs by @emmanuel-ferdman in #3048
- Update constraint, index, and migration stubs by @emmanuel-ferdman in #3051
- Update GIS module stubs by @emmanuel-ferdman in #3054
- Update PostgreSQL backend stubs by @emmanuel-ferdman in #3070
- Update Oracle utils stubs by @emmanuel-ferdman in #3066
- Update SQLite backend stubs by @emmanuel-ferdman in #3072
- Update base database backend stubs by @emmanuel-ferdman in #3075
- Update MySQL and Oracle backend stubs by @emmanuel-ferdman in #3078
- Update compiler stubs by @emmanuel-ferdman in #3079
- Remove deprecated stubs and add referenced_fields by @emmanuel-ferdman in #3081
- Add missing JSON lookup method stubs by @emmanuel-ferdman in #3082
- Add types for BaseBinaryDumper in postgis base by @ahmedasar00 in #3099
- Add missing Model base class stubs by @emmanuel-ferdman in #3101
- Add model expressions stubs by @emmanuel-ferdman in #3096
Other stubs improvements
- Fix
SessionBasedict method signatures by @emmanuel-ferdman in #3020 - Fix WSGI
LimitedStreamstub signatures by @emmanuel-ferdman in #3022 - Replaced
IO[bytes]with_PostDataProtocolto fixHttpRequestcompatibility by @Skyiesac in #3167 ResponseHeaderscan take any mapping, not justdictby @sobolevn in #3014- Allow
formfield_callbackto returnNoneby @emmanuel-ferdman in #3021 - Add overloads to Library.inclusion_tag for proper type inference by @rgant in #3039
- Add missing items across contrib module stubs by @emmanuel-ferdman in #3049
- Add missing items across core module stubs by @emmanuel-ferdman in #3058
- Fix lower bound for
response_gone_classby @UnknownPlatypus in #3061 - Add admin helper and autocomplete stubs by @emmanuel-ferdman in #3063
- Fix auth and contenttypes stub signatures by @emmanuel-ferdman in #3069
- Allow
get_violation_error_messageto return dictionaries by @meunomemauricio in #3065 - Fix database router type hints by @emmanuel-ferdman in #3074
- Allow UserAdmin with custom user models by @emmanuel-ferdman in #3076
- Fix conflated decorator and decorator factory return types by @emmanuel-ferdman in #3080
- Add form_class stubs on auth views by @emmanuel-ferdman in #3083
- Fix password hasher stubs and add missing members by @emmanuel-ferdman in #3084
- Allow TransactionTestCase.assertQuerySetEqual to take values=Iterable by @cjwatson in #3087
- Update min/max/step parameters of IntegerField to accept Callables by @LincolnPuzey in #3093
- Fix login_required overloads and auth model stubs by @emmanuel-ferdman in #3090
- Add migration autodetector and questioner stubs by @emmanuel-ferdman in #3095
- Add types BaseTextDumper in postgis base by @ahmedasar00 in #3100
- Add missing GIS geometry and measure stubs by @emmanuel-ferdman in #3102
- Fix
SubqueryandExiststo accept subquery inputs by @emmanuel-ferdman in #3103 - Add missing GDAL geometry and SRS stubs by @emmanuel-ferdman in #3104
- Fix encoding functions returning Any instead of str/bytes by @emmanuel-ferdman in #3106
- Add GIS management command stubs by @emmanuel-ferdman in #3107
- Add missing GeoModelAdminMixin and fix GISModelAdmin types by @emmanuel-ferdman in #3108
- Add missing GeographyType stub in postgis base.pyi by @ahmedasar00 in #3113
- Add types for register_geometry_adapters in postgis base by @DeXtAr47-oss in #3105
- Improve template module stubs by @emmanuel-ferdman in #3114
- Add missing aggregate and lookup attributes by @emmanuel-ferdman in #3118
- Add stubs for
AdminSeleniumTestCase.assertCountSeleniumElementsby @DeXtAr47-oss in #3117 - Fix test runner stubs by @emmanuel-ferdman in #3119
- Allow expressions in ordering types by @emmanuel-ferdman in #3121
- Add missing database function stubs by @emmanuel-ferdman in #3122
- Fix MySQL backend feature stubs by @emmanuel-ferdman in #3124
- 5.2: Add Field.has_db_default method by @JaeHyuckSa in #3125
- Fix lazy function return types by @emmanuel-ferdman in #3133
- 5.2: Add
BaseDatabaseFeatures.rounds_to_evenby @JaeHyuckSa in #3128 - 5.2: Add
django.db.models.fields.tuple_lookups moduleby @JaeHyuckSa in #3131 - 5.2: Fix Oracle backend feature stubs by @emmanuel-ferdman in #3136
- 5.2: Add
ForeignKey.cast_db_typemethod by @JaeHyuckSa in #3126 - 5.2: Add
BaseDatabaseFeatures.supports_tuple_lookupsby @JaeHyuckSa in #3129 - 5.2: Add
Q.identitycached_propertyby @JaeHyuckSa in #3127 - 5.2: Add
BaseDatabaseSchemaEditor.sql_pk_constraintby @JaeHyuckSa in #3130 - Fix SQL query module type stubs by @emmanuel-ferdman in #3138
- 5.2: Remove
MySQLGISSchemaEditor.__init__by @JaeHyuckSa in #3139 - Add stubs for SeleniumTestCaseBase and SeleniumTestCase by @DeXtAr47-oss in #3135
- Fix query and query_utils module stubs by @emmanuel-ferdman in #3140
- Fix testcases module stubs by @emmanuel-ferdman in #3143
- Type the view parameter of conf.urls.static.static by @rgant in #3145
- Add DB and GIS backends module stubs by @emmanuel-ferdman in #3144
- Add missing FileField and ImageField class attributes by @emmanuel-ferdman in #3147
- Add missing methods and fix inheritance in forms stubs by @emmanuel-ferdman in #3153
- Improve stubs for
django.utils.datastructures.ImmutableListby @ngnpope in #3155 - Fix selenium test case stubs by @emmanuel-ferdman in #3159
- Fix URL module stubs by @emmanuel-ferdman in #3160
- Fix password and auth helper stub annotations by @emmanuel-ferdman in #3161
- Add missing field stub members and fix type annotations by @emmanuel-ferdman in #3164
- Add GIS function and contenttypes stub annotations by @emmanuel-ferdman in #3169
- Remove stale stub attributes that no longer exist at runtime by @emmanuel-ferdman in #3175
- Improve types fo LazyObject dunder method by @UnknownPlatypus in #3166
- Fix stubs for
django.db.models.expressions.Windowby @ngnpope in #3170 - Fix
value_to_stringreturn types for JSONField and RangeField by @emmanuel-ferdman in #3188 - Fix stubs for
allowed_defaultin expression classes by @ahmedasar00 in #3186 - Add stub for register_combinable_fields in expressions by @ahmedasar00 in #3189
- Improve forms module type annotations by @emmanuel-ferdman in #3191
Plugin updates
- Add plugin support for
NotUpdatedexception by @ngnpope in #3046 - Handle lookups in Annotated fields by @gg-mmill in #3097
- Fix edge case with
Prefetch+to_attrand multiple levels by @UnknownPlatypus in #3151 - Validate the
update_fieldsandunique_fieldsofbulk_createby @UnknownPlatypus in #3150 - Validate
earliest/latest/orderbyby @UnknownPlatypus in #3158 - Validate
only/deferby @UnknownPlatypus in #3165 - Fix order_by false positives with field transforms by @federicobond in #3178
- Fix order_by false positive with values() expression aliases by @federicobond in #3185
Housekeeping
- Tests: Update to Django 6.0; fall back to 5.2 on Python <3.12 by @intgr in #2939
- Django 6.0.1 by @sobolevn in #2984
- Run tests with Python 3.14 (except stubtest) by @sobolevn in #2866
- Docs: Update versions table & Django/Python version by @intgr in #3008
- Add Django 6.0 allowlist to contributing guide by @emmanuel-ferdman in #3073
- Add tests for
_PropertyDescriptorusage inresponse.pyiby @sobolevn in #3086 - Expand reverse fk lookup tests by @UnknownPlatypus in #3141
- Fix
django.utils.inspectstubtest errors on Python 3.14+ by @ngnpope in #3152 - Enable
explicit-overrideand--disallow-subclassing-anyby @ngnpope in #3172 - Bump pyright target from Python 3.8 to 3.10 by @emmanuel-ferdman in #3176
- Fix Django 5.2 stubtest allowlist: resolve and clean up todo entries by @ahmedasar00 in #3179
- Remove references to stale stubtest allowlists by @ngnpope in #3182
- Add
django-modern-restto the README by @sobolevn in #3183 - Update docs.djangoproject.com links to current stable version by @intgr in #3194
New Contributors
- @Tosinibikunle made their first contribution in #2951
- @rgant made their first contribution in #3039
- @meunomemauricio made their first contribution in #3065
- @ahmedasar00 made their first contribution in #3099
- @DeXtAr47-oss made their first contribution in #3105
- @Skyiesac made their first contribution in #3167
Full Changelog: 5.2.9...6.0.0