github typeddjango/django-stubs 4.2.7

latest release: 5.0.0
5 months ago

Headline changes

  • mypy 1.7: Recommended mypy version updated to 1.7.x
  • Improved type inference for ManyToManyField and Model.<manytomany>.through
  • If you previously imported RelatedManager or ManyRelatedManager, 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 fixed Model.<manytomany>.through typing by @flaeppe in #1805
  • Fixed Self-typed custom queryset methods to be compatible with QuerySet 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 allow OrderBy objects by @HansAarneLiblik in #1847

Stubs fixes

  • Added missing search_help_text= parameter to ChangeList.__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 for django.db.models.Field.__init__() by @flaeppe in #1815
  • Added missing RelatedField.__init__() method and removed ForeignObject.__init__(db_constraint=) parameter in Field constructors by @flaeppe in #1816
  • Fixed argument types of assertNumQueries() and assertQuerySetEqual() by @flaeppe in #1823
  • Fixed get_deleted_objects() return from list[Model] -> list[str] by @golgor in #1825
  • Removed incorrect django.db.models re-exports by @intgr in #1835
  • Fixed TemplateResponse.cookies attribute and SimpleCookie 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 and NestedObjects 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 or ClassVar and improves type by @UnknownPlatypus in #1769

Housekeeping

  • Moved plugin generated <Model>_RelatedManager entries to allowlist by @flaeppe in #1806
  • Moved RelatedManager to django.db.models.fields.related_descriptors by @flaeppe in #1814
  • Restored RelatedManager, ManyRelatedManager to inherit from Manager not BaseManager 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

Full Changelog: 4.2.6...4.2.7

Don't miss a new django-stubs release

NewReleases is sending notifications on new releases.