Commit Graph

609 Commits

Author SHA1 Message Date
proxy
ffb6551eb4 make BaseModelAdmin generic to properly type methods dealing with models (#504)
* make BaseModelAdmin generic to properly type the `obj` argument of ModelAdmin.delete_model
closes #482

* turn BaseModelAdmin into bound generic, run black

* add test for generic ModelAdmin
2020-10-28 01:02:43 +03:00
Nikita Sobolev
40c8bfa510 Update migration.pyi (#501)
* Update migration.pyi

* Fixes tests

* Fixes tests

* Fixes tests
2020-10-26 11:43:47 +03:00
Nikita Sobolev
402b7d563f Update http.pyi (#502) 2020-10-26 00:01:36 +03:00
Daniel Hillier
92eb068a04 Fix #224 add paths in mypy's mypy_path option or MYPYPATH env var for import discovery (#498) 2020-10-23 01:06:49 +03:00
Brian Helba
9d4d06f8b3 Allow overridable checks to be CheckMessage (#497)
* Allow overridable checks to be CheckMessage

The checks framework expects return types to be "List[CheckMessage]". This
allows all overridable checks-returning methods to return the more general
"CheckMessage", instead of the "Error" subclass.

* Ignore an incorrect usage of the checks API in Django 2.2
2020-10-22 15:12:36 +03:00
giladsheffer
d746e3f5e4 user parameter for login accepts None (#496)
Co-authored-by: Gilad Sheffer <gilad@orca.security>
2020-10-19 18:15:44 +03:00
proxy
8729a74f81 correct the type signature of AbstractBaseUser.set_password (#493) 2020-10-18 11:54:10 +03:00
Mark Story
56361b353e Fix typoand grammar in readme (#491) 2020-10-15 12:47:15 +03:00
Noam
b71c9ad282 Changed model exceptions to use more specific base classes. (#490) 2020-10-14 18:41:23 +03:00
Na'aman Hirschfeld
ce370ea79f Missing stubs (#467)
* adding missing db.backends typings and updated test

* added missing stubs

* reformatted files

* removed contrib.postgres.forms

* fixed test
2020-10-11 12:14:08 +03:00
Mariam Maarouf
2a732fd257 renderer = BaseRenderer instead of EngineMixin in Widget.render() (#481) 2020-10-07 20:19:12 +03:00
sobolevn
645ee97e78 Release 1.6.0 1.6.0 2020-10-01 10:57:05 +03:00
William Schwartz
5bc3759ea2 Template Loader.get_template_sources yield Origins (#476)
django.template.loaders.base.Loader.get_template_sources should yield Origins:
https://docs.djangoproject.com/en/3.1/ref/templates/api/#django.template.loaders.base.Loader.get_template_sources

Currently it's returning none. Objects that yield should be marked as iterables.
https://mypy.readthedocs.io/en/stable/kinds_of_types.html#generators
2020-09-30 01:21:38 +03:00
henribru
534a028ea2 Use AbstractBaseUser where possible (#475)
Fixes #431
2020-09-29 22:04:20 +03:00
Nicolas Delaby
87856754ea psycopg2-binary is faster to install (#473) 2020-09-29 12:50:11 +03:00
Szymon Pyżalski
2f7fac2eaf Allowed to use decimal in combinables (#454)
Co-authored-by: Szymon Pyżalski <spyzalski@egnyte.com>
2020-09-21 15:00:32 +03:00
Marti Raudsepp
5ff99fd047 Check arguments to django.urls.{path,re_path} functions (#464)
These functions were added in Django 2.0, but the stubs have been
incomplete since commit 9a68263257

The implementation is almost identical to `url()` from
`conf/urls/__init__.pyi`
2020-09-17 18:08:26 +03:00
Marti Raudsepp
f77ebcd22c Add db.models.constants stub module (#462) 2020-09-17 18:07:03 +03:00
Alexander Viklund
34b126e3da Fix wrong type for parse_until in template parser (#460) 2020-09-12 01:58:09 +03:00
Jonathan Moss
6e5f5f2cdb Allows FileField storage to be a Callable (#453)
* Allows FileField storage to be a Callable

The `storage` parameter of `FileField` (and by extension `ImageField`)
is not limited to just taking an instance of `Storage`. It can also take
a no-args callable that returns an instance of `Storage`.

* correcting linting issue in forms.pyi
2020-08-28 10:14:57 +03:00
James Perretta
95252cde60 Add "one_to_many", "one_to_one", "many_to_many," and "many_to_one" attributes to Field base class (#449)
* Add "_to_many" and "_to_one" bool attributes to Field base class.

* Remove unused import from test case.
2020-08-24 23:09:15 +03:00
Zach Waggoner
6ef2cf0331 Add force_color parameter to django.core.management.color.color_style (#448) 2020-08-21 12:41:51 +03:00
Alexander Viklund
9f3b95841b return type for translation.get_language should not be Optional (#446) 2020-08-18 12:41:52 +03:00
Federico Bond
e764b1cf4c Add route argument to ResolverMatch constructor (#442) 2020-08-12 15:36:01 +03:00
Šarūnas Nejus
8a64d87917 Output a more clear configuration error (#421)
* Output a more clear configuration error

* Performance related improvements in config read handling

* Check python 3.6 with travis

* Revert the .travis.yml py36 inclusion

* Added tests for input error handling

* Thanks isort, isorted it out

* Make exit() function a bit more aesthetic

* Single quote -> double quote docstrings

* Whitespace removed
2020-08-09 11:27:21 +03:00
Daniel Hillier
60f3f9dd9f Change select_for_update's 'of' type to Sequence[str] (#440) 2020-08-08 20:21:55 +03:00
Mantas Zimnickas
ca10ee9242 Fix staff_member_required annotations (#436)
* Fix staff_member_required annotations

`redirect_field_name` can be `None`.

* Reformat code with black
2020-07-31 10:35:35 +03:00
Sigurd Ljødal
f651f27ddf Fix type of update_fields parameter to Model.save (#437)
Sending in a single string leads to unexpected behavior and the method
accepts any iterable, not just sequences, of strings.

Technically sending in a single string is still allowed because a string
is an iterable of strings, but this way the intention of that argument
is clearer.
2020-07-31 10:14:35 +03:00
Kacper
3915aa0639 AttributeError exception in build_unannotated_method_args (#429)
* AttributeError exception in build_unannotated_method_args

* assigning [] to arguments if AttributeError

Co-authored-by: Kacper Szmigiel <szmigielkacper@gmai.com>
2020-07-21 15:31:19 +03:00
Nate Clark
97ec2ee43b Allow Field.widget to be a class or instance (#426)
According to source below, a Field's widget is allowed to be a class or instance of Widget.

156a2138db/django/forms/fields.py (L63-L66)
2020-07-16 00:51:29 +03:00
Daniel Hillier
19c73a106d admin: Allow ModelAdmin.actions to contain str (#425)
Strings are allowed in ModelAdmin.actions when they refer to a method on
the ModelAdmin subclass.
2020-07-14 10:43:50 +03:00
Kacper
92ef5d9d95 additional defer() to offset the effect of using the type before decl… (#424)
* additional defer() to offset the effect of using the type before declaring

* linter fix

* linter fix

* linter fix

* test case

Co-authored-by: Kacper Szmigiel <szmigielkacper@gmai.com>
2020-07-13 16:31:13 +03:00
Daniel Hillier
f16d1b8cb6 Improve *HttpResponse.getvalue() types (#422)
* Change returned type of StreamingHttpResponse.getvalue() to bytes

* Add HttpResponse.getvalue() definition
2020-07-11 15:57:35 +03:00
Alexander Viklund
c3cdc1c2d5 Allow more types for args to Paginator.get_page (#418) 2020-07-08 22:53:38 +03:00
Alexander Viklund
3704d0ab98 Don't change type of HttpRequest.user if type has been changed by subclassing (#415)
* Don't change type of HttpRequest.user if type has been changed by subclassing

* Asserts for typing

* Add tests

* Add description of HttpRequest subclassing to README

* Dummy to rebuild travis
2020-07-07 12:52:21 +03:00
Kacper
b1d619edb2 Bumped required Mypy version to newest in requirements (#414)
* pytest-mypy-plugins package newer version

* Revert "pytest-mypy-plugins package newer version"

This reverts commit 871347a86577a5dad867bc751689bbc06d2bcae0.

* update tests ignores for django

* Revert "update tests ignores for django"

This reverts commit 93fc66e311af62cf8cf5b79a72ab723bf3cf060a.

* changed required mypy version to the newest

Co-authored-by: Kacper Szmigiel <szmigielkacper@gmai.com>
2020-07-06 10:34:17 +03:00
Akseli Nelander
e680326c72 Fix partition signature (#413) 2020-07-01 15:35:35 +03:00
Étienne
574a87e68c explicitly mark value and label types on choices enum (#406)
In addition to the meta properties added
to the Choices enums, value and label are
set for each choice.
This commit explicitly types those instead of the
tuple value and non-extant label types
2020-06-22 11:08:09 +03:00
coiax
82ae1751ed 🐑 Update update_session_auth_hash() stub (#401)
The update_session_auth_hash() stub doesn't match the documented and
actual type that the function expects.

---

Resolves #400.
2020-06-16 19:19:11 +03:00
Ceesjan Luiten
69042783b1 Allow form.save() in CreateView / UpdateView (#374) 2020-06-12 21:12:56 +03:00
Kacper
391bbc59d5 WIP Fix ci/cd (#396)
* pytest-mypy-plugins package newer version

* Revert "pytest-mypy-plugins package newer version"

This reverts commit 871347a86577a5dad867bc751689bbc06d2bcae0.

* update tests ignores for django

* Revert "update tests ignores for django"

This reverts commit 93fc66e311af62cf8cf5b79a72ab723bf3cf060a.

* lets see what happen :)

Co-authored-by: Kacper Szmigiel <szmigielkacper@gmai.com>
2020-06-11 23:05:59 +03:00
Michael
28c76df3b2 Fix compatibility table in readme (#395) 2020-06-10 16:03:00 +03:00
Nikita Sobolev
3d2534ea8d Closes #392 2020-06-08 10:55:30 +03:00
Kacper
54f5f63e71 Issue 379 (#391)
* pytest-mypy-plugins package newer version

* Revert "pytest-mypy-plugins package newer version"

This reverts commit 871347a86577a5dad867bc751689bbc06d2bcae0.

* update tests ignores for django

* Revert "update tests ignores for django"

This reverts commit 93fc66e311af62cf8cf5b79a72ab723bf3cf060a.

* tests for python 3.8 WIP - initial commit

Co-authored-by: Kacper Szmigiel <szmigielkacper@gmai.com>
2020-06-06 14:28:28 +03:00
Kacper
4c5723d368 WIP Issue 388 (#390)
* updated mypy dependency

* update readme

* readme update v2

* pytest-mypy-plugins newer version

* updated pytest_mypy_plugins name

* update ignored errors for typechecking django test suite

Co-authored-by: Kacper Szmigiel <szmigielkacper@gmai.com>
2020-06-06 11:35:51 +03:00
Alexander Viklund
7e0e43135d BaseForm.prefix may be None (#389) 2020-06-04 21:24:42 +03:00
Kacper
e05b84e32d Issue 378 (#387)
* proper redirect return type annotations made with Literal

* Mapping instead of Dict type annotation for context in render() with test

* removed Union and Context

* typo

Co-authored-by: Kacper Szmigiel <szmigielkacper@gmai.com>

Add __init__ to OrderedSet (#381)

Issue 382 (#384)

* WIP fix, pushed for testing

* added _ prefix for internal types

Co-authored-by: Kacper Szmigiel <szmigielkacper@gmai.com>

Fix parameter types for assertJSONEqual/NotEqual (#385)

Add get_supported_language_variant (#386)

Issue 309 (#383)

* added tags for user models

* type test for HttpRequest.user

* test for User and AnonymousUser tags

* httrequest test fix

* checking python version fix for readibility

* Rewrite version check for readability

* Annotate is_authenticated/is_anonymous with Literal-type

* Add auth in INSTALLED_APPS in test

* Fix wrong type assertion in test

* Fix misconception of how branch-testing works

* Remove user from WSGIRequest

* Change HttpRequest-transformer to set user-type to include AnonymousUser

* Add check for anonymous_user_info=None to appease mypy

* Isort transformers/request

* Remove trailing whitespace

* Remove unused import

Co-authored-by: Kacper Szmigiel <szmigielkacper@gmai.com>

* fix formatting and unused import

* reformatted again

Co-authored-by: Kacper Szmigiel <szmigielkacper@gmai.com>
2020-06-03 23:46:30 +03:00
Alexander Viklund
71751d3795 Issue 309 (#383)
* added tags for user models

* type test for HttpRequest.user

* test for User and AnonymousUser tags

* httrequest test fix

* checking python version fix for readibility

* Rewrite version check for readability

* Annotate is_authenticated/is_anonymous with Literal-type

* Add auth in INSTALLED_APPS in test

* Fix wrong type assertion in test

* Fix misconception of how branch-testing works

* Remove user from WSGIRequest

* Change HttpRequest-transformer to set user-type to include AnonymousUser

* Add check for anonymous_user_info=None to appease mypy

* Isort transformers/request

* Remove trailing whitespace

* Remove unused import

Co-authored-by: Kacper Szmigiel <szmigielkacper@gmai.com>
2020-06-03 20:29:19 +03:00
Alexander Viklund
25f92e8e56 Add get_supported_language_variant (#386) 2020-06-03 20:04:19 +03:00
Alexander Viklund
28d47c7e93 Fix parameter types for assertJSONEqual/NotEqual (#385) 2020-06-03 20:03:59 +03:00