Commit Graph

1030 Commits

Author SHA1 Message Date
Adam Johnson
7bce5c2081 BaseDeleteView now extends FormMixin (#1215)
* BaseDeleteView now extends FormMixin

Co-Authored-By: Simon Kohlmeyer <simon.kohlmeyer@gmail.com>

* With Generic

Co-authored-by: Simon Kohlmeyer <simon.kohlmeyer@gmail.com>
2022-10-28 23:36:38 +03:00
Guillaume Andreu Sabater
875acf76d7 Fixed F's asc and desc args (#1213)
* fixed F asc & desc signature

* improved BaseExpression asc & desc signature
2022-10-28 15:59:18 +03:00
Marti Raudsepp
36044c98b8 Add lots of missing argument & return type hints (#1204)
* Add lots of missing argument & return type hints

Discovered by setting mypy options disallow_untyped_defs, disallow_incomplete_defs.

* Sequence -> List

* Fixes from review

* Drop ordering_field

* Revert ModelBackend.with_perm

* typing_extensions.TypedDict instead

* bla

* Remove private method _get_lines_from_file

* A few additions

* Hints for BaseSpatialFeatures
2022-10-28 13:08:00 +03:00
Adam Johnson
e20d5307d1 Add BaseDatabaseSchemaEditor.table_sql() (#1212)
Co-Authored-By: Ryan Vinzent <ryan.vinzent@invitae.com>

Co-authored-by: Ryan Vinzent <ryan.vinzent@invitae.com>
2022-10-27 21:32:50 +03:00
Adam Johnson
ae5af12c9b Add BaseDetailView.object (#1211) 2022-10-27 21:32:08 +03:00
Adam Johnson
85ae4bb704 Add django.db.models.base.model_unpickle (#1209) 2022-10-27 21:30:44 +03:00
Adam Johnson
efebe22397 Add auto_now attrs to date and time model fields (#1210)
Co-Authored-By: Ben Nace <ben2701@verizon.net>

Co-authored-by: Ben Nace <ben2701@verizon.net>
2022-10-27 20:52:48 +03:00
dependabot[bot]
f9fbeb0f9b Bump pytest from 7.1.3 to 7.2.0 (#1203)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.1.3 to 7.2.0.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/7.1.3...7.2.0)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-27 11:37:05 +03:00
dependabot[bot]
73312caa24 Bump pytest-mypy-plugins from 1.10.0 to 1.10.1 (#1205)
Bumps [pytest-mypy-plugins](https://github.com/TypedDjango/pytest-mypy-plugins) from 1.10.0 to 1.10.1.
- [Release notes](https://github.com/TypedDjango/pytest-mypy-plugins/releases)
- [Changelog](https://github.com/typeddjango/pytest-mypy-plugins/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypedDjango/pytest-mypy-plugins/compare/1.10.0...1.10.1)

---
updated-dependencies:
- dependency-name: pytest-mypy-plugins
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-27 09:00:41 +03:00
Petter Friberg
6aecafc64f Improve type of TestCase.captureOnCommitCallbacks (#1202)
Co-authored-by: Adam Johnson <me@adamj.eu>
2022-10-25 09:47:09 +01:00
Petter Friberg
adb26248db Allow assertQuerySetEqual to compare with a collection of values (#1201) 2022-10-25 00:50:08 +03:00
Thibaut Decombe
71b06f5bb3 Generic sitemap (#1198)
* Add test for both issue cases

* Use generic type and add new django 4.1 `get_latest_lastmod` method

* Add Sitemap to monkeypatch

* Update test case to use generic + add failing case

* Test GenericSitemap too
2022-10-22 20:58:59 +03:00
James Owen
fb9ad1c7fe Add hints for instance variables in console.EmailBackend (#1200) 2022-10-21 16:42:21 +01:00
Adam Johnson
36002a2087 Standardize all context manager __exit__ methods (#1194) 2022-10-19 10:31:38 +01:00
Adam Johnson
54e75fbe74 Update cache timeout parameters to floats (#1193) 2022-10-19 10:31:29 +01:00
Thibaut Decombe
14ff5ad7a8 Fix RelatedManager not callable (#1191)
* Add failing test

* Add call annotation
2022-10-19 11:14:51 +03:00
dependabot[bot]
a78c59226a Bump gitpython from 3.1.28 to 3.1.29 (#1187)
Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.28 to 3.1.29.
- [Release notes](https://github.com/gitpython-developers/GitPython/releases)
- [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES)
- [Commits](https://github.com/gitpython-developers/GitPython/compare/3.1.28...3.1.29)

---
updated-dependencies:
- dependency-name: gitpython
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-11 09:56:16 +03:00
github-actions[bot]
1c914abfa8 Auto-update pre-commit hooks (#1188)
Co-authored-by: sobolevn <sobolevn@users.noreply.github.com>
2022-10-11 09:56:01 +03:00
dependabot[bot]
994312672e Bump black from 22.8.0 to 22.10.0 (#1184)
Bumps [black](https://github.com/psf/black) from 22.8.0 to 22.10.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](https://github.com/psf/black/compare/22.8.0...22.10.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-07 09:37:11 +03:00
dependabot[bot]
4235bf7585 Bump gitpython from 3.1.27 to 3.1.28 (#1185)
Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.27 to 3.1.28.
- [Release notes](https://github.com/gitpython-developers/GitPython/releases)
- [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES)
- [Commits](https://github.com/gitpython-developers/GitPython/compare/3.1.27...3.1.28)

---
updated-dependencies:
- dependency-name: gitpython
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-07 09:37:03 +03:00
github-actions[bot]
1cc6ec39a6 Auto-update pre-commit hooks (#1186)
Co-authored-by: sobolevn <sobolevn@users.noreply.github.com>
2022-10-07 09:36:53 +03:00
Anders Kaseorg
41deee4ec6 Update utils.log.log_response type for Django 4.1 (#1183)
90cf963264

Signed-off-by: Anders Kaseorg <andersk@mit.edu>

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2022-10-06 11:22:20 +03:00
PIG208
05dc579748 Add missing re-export for JSONObject. (#1182) 2022-10-06 08:43:05 +01:00
github-actions[bot]
3a2f806282 Auto-update pre-commit hooks (#1181)
Co-authored-by: sobolevn <sobolevn@users.noreply.github.com>
2022-10-05 12:55:39 +03:00
dependabot[bot]
4bdf385602 Bump mypy from 0.981 to 0.982 (#1180)
Bumps [mypy](https://github.com/python/mypy) from 0.981 to 0.982.
- [Release notes](https://github.com/python/mypy/releases)
- [Commits](https://github.com/python/mypy/compare/v0.981...v0.982)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-04 11:13:05 +03:00
Sigurd Ljødal
dde0f2f876 Reparametrize managers without explicit type parameters (#1169)
* Reparametrize managers without explicit type parameters

This extracts the reparametrization logic from #1030 in addition to
removing the codepath that copied methods from querysets to managers.
That code path seems to not be needed with this change.

* Use typevars from parent instead of base

* Use typevars from parent manager instead of base manager

This removes warnings when subclassing from something other than the
base manager class, where the typevar has been restricted.

* Remove unused imports

* Fix failed test

* Only reparametrize if generics are omitted

* Fix docstring

* Add test with disallow_any_generics=True

* Add an FAQ section and document disallow_any_generics behaviour
2022-10-03 20:36:45 +03:00
Marti Raudsepp
946274bed8 Add UUIDField lookup types (#1178) 2022-10-02 13:48:37 +03:00
Marti Raudsepp
db14454199 Fix type of <fieldname>_id when using ForeignKey(to_field=) (#1176)
* Fix type of <fieldname>_id when using ForeignKey(to_field=)

Previously mypy_django_plugin would always use the field type of target
model's primary key, but `to_field` can refer to a different field type.

* Fixes

* More fixes
2022-09-30 10:05:57 +03:00
Sigurd Ljødal
5c616863dc Add SETTINGS_MODULE to Settings and LazySettings (#1175)
Add SETTINGS_MODULE as an attriute to the Settings and LazySettings
classes. This makes mypy aware of this attribute.

Fixes #1174
2022-09-30 10:03:54 +03:00
Petter Friberg
54d5835f66 Implement support for <QuerySet>.as_manager() (#1025)
* Implement support for `<QuerySet>.as_manager()`

* fixup! Implement support for `<QuerySet>.as_manager()`

* fixup! fixup! Implement support for `<QuerySet>.as_manager()`
2022-09-29 15:05:25 +03:00
Sigurd Ljødal
1f2e406972 Don't allow promise to be passed to ArrayField.name (#1171)
This was incorrectly changed in #1168, so reverting that change.
2022-09-28 16:34:43 +03:00
Marti Raudsepp
56f74f1940 Disallow passing bytes for field verbose_name (#1170)
`verbose_name` is intended to be a human-readable string, not binary.
2022-09-27 19:56:25 +03:00
Sigurd Ljødal
199a7f2707 Allow Promise to be passed to ArrayField.verbose_name (#1168)
* Allow Promise to be passed to ArrayField.verbose_name

* Remove bytes and allow Promise for name as well
2022-09-27 17:53:28 +03:00
Nikita Sobolev
93fa1d2e19 Update mypy to 0.981 (#1167)
* Update mypy to 0.981

* Fix plugin API

* Fix scripts

* Fix scripts

* Fix plugin
2022-09-27 11:55:36 +03:00
github-actions[bot]
bba51ce67d Auto-update pre-commit hooks (#1165)
Co-authored-by: sobolevn <sobolevn@users.noreply.github.com>
2022-09-26 09:17:41 +03:00
github-actions[bot]
f6a8c8dc8d Auto-update pre-commit hooks (#1164)
Co-authored-by: sobolevn <sobolevn@users.noreply.github.com>
2022-09-25 08:51:38 +03:00
Anders Kaseorg
9bd8aed1e1 Disable fallback to runtime types for Django settings (#1163)
This fallback to value.__class__ seems to be doing more harm than
good; see #312 and #1162.  Replace it with a clear error message that
suggests a way to fix the problem rather than incompletely papering
over it.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2022-09-24 10:57:45 +03:00
Sigurd Ljødal
02999f3e86 Fix unresolved placeholder error during serialization (#1161)
This fixes an error that occured during state serialization. Completely
unsure how to reproduce this in a test but it resolves a long-standing
prolem in our project at work at least.
2022-09-23 21:35:23 +03:00
PIG208
3bc8278424 Fix paramters for ParallelTestSuite and RemoteTestRunner. (#1072)
* Fix paramters for ParallelTestSuite and RemoteTestRunner.

A new parameter `buffer` is added. `suites` is renamed to `subsuites`.

ParallelTestSuite:
2fac0a1808/django/test/runner.py (L468-L475)

RemoteTestRunner:
2fac0a1808/django/test/runner.py (L350)

`buffer` was added in f6713cda89,
`suites` was renamed in cb6c19749d.
Both of these changes were made in 4.1rc1.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>

* Adjust types of attributes for runners.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-09-20 08:52:16 +03:00
Petter Friberg
6f9afd3cc9 Relax fields= arg for refresh_from_db to accept Sequence (#1156) 2022-09-19 23:14:08 +01:00
PIG208
d7326315b1 Improve stubs for runserver management command. (#1037)
This adds type annotation for `run`, `get_handler`, `inner_run` and
`server_cls`.

Source code:
03eec9ff6c/django/core/management/commands/runserver.py
2022-09-19 22:30:04 +03:00
PIG208
9a41aa63ba Broaden type annotation for verbose_name(_plural) to accept lazystr. (#1139)
* Broaden type annotation for verbose_name(_plural) to accept lazystr.

Fixes #1137.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>

* Broaden type annotation for help_text to accept lazystr.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>

* Broaden type annotation for ValidationError to accept lazystr.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>

* Broaden type annotation for label to accept lazystr.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>

* Add StrPromise and StrOrPromise aliases to django_stubs_ext.

We make StrPromise and StrOrPromise available via django_stubs_ext so
that conditional imports with TYPE_CHECKING is not required.
These aliases fall back to Promise or Union[str, Promise]
when not TYPE_CHECKING.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-09-19 17:01:44 +03:00
Petter Friberg
a2a3543198 Adjust choices= type variance for model fields (#1154)
Avoid getting stuck in an invariance pit. I don't think it makes sense
to mix two tuple with named group elements in same choices sequence(?).

This also changes the outermost container type to `Sequence` as e.g.
both `tuple` and `list` are supported.
2022-09-19 13:17:17 +03:00
github-actions[bot]
88793ee3f7 Auto-update pre-commit hooks (#1153) 2022-09-16 08:32:46 +01:00
Petter Friberg
b34ebe7553 Serialize RelatedManager attributes in cache (#1152) 2022-09-15 23:54:10 +03:00
Adam Johnson
29e2b65c8b Improve Flake8 config (#1149) 2022-09-09 17:16:22 +03:00
Yannik Rödel
abd0609f80 Add type and parameter fields to MediaType (#1103) 2022-09-09 14:48:24 +01:00
Adam Johnson
3c942483d4 Correct EmailMultiAlternatives.body (#1146) 2022-09-08 14:13:54 +03:00
dependabot[bot]
354a892ecc Bump pytest from 7.1.2 to 7.1.3 (#1144)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.1.2 to 7.1.3.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/7.1.2...7.1.3)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-05 16:26:19 +03:00
Søren Howe Gersager
678a5a0302 Add django.db.models.functions.Collate (#1143) 2022-09-05 14:03:02 +01:00