Commit Graph

678 Commits

Author SHA1 Message Date
Daniel Hahler
ee58b18f15 WIP: django_stubs_ext: monkeypatch reveal_{type,locals} into builtins (#591)
* WIP: django_stubs_ext: monkeypatch `reveal_{type,locals}` into builtins

Fixes https://github.com/typeddjango/django-stubs/issues/590

* fixup! WIP: django_stubs_ext: monkeypatch `reveal_{type,locals}` into builtins

* fixup! fixup! WIP: django_stubs_ext: monkeypatch `reveal_{type,locals}` into builtins

* Update patch.py

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2021-04-14 12:33:45 +03:00
Daniel Hahler
3c6f438cc9 build(deps-dev): remove/unpin mypy/typing-extensions (#593)
* build(deps-dev): remove/unpin mypy/typing-extensions

Closes https://github.com/typeddjango/django-stubs/issues/592.

* Update test_options.yml

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2021-04-14 12:27:15 +03:00
Hannes Ljungberg
a14f49c4b2 [3.2] Adjust contrib.admin (#589) 2021-04-13 21:36:24 +03:00
Hannes Ljungberg
f003968177 [3.2] Add missing exceptions (#588) 2021-04-13 13:18:42 +03:00
Hannes Ljungberg
e8a97e301c [3.2] Adjust model indexes (#587) 2021-04-13 13:18:13 +03:00
Hannes Ljungberg
e72cbb6eb5 [3.2] Add durable argument to atomic (#586)
* [3.2] Add durable argument to atomic

* Adjust compatibility table for 3.2

* Update README.md

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2021-04-13 13:17:30 +03:00
sobolevn
3cca71a58f Version 1.8.0 release 2021-04-12 13:12:19 +03:00
LanDinh
ceb08f1804 Add URLPattern options to django.url.conf since they were missing. (#583)
* Add URLPattern options to django.url.conf since they were missing.

* Fix some wording in the contribution guide & fix a reference to Django version 3.0, which has since been replaced by 3.1 as new stable version.

* My bad - I was misreading the type hints a bit here. Fix tests.

* We need to specify the List[Union[URLResolver, URLPattern]] upfront, since those don't accept List[URLResolver] as argument.

* Add test to ensure that path() accepts a mix of URLPatterns & URLResolvers.

Co-authored-by: LanDinh <coding+sourcetree@khaleesi.ninja>
2021-04-10 18:01:40 +03:00
Konstantin Alekseev
9beb5327de Create related managers from generated managers (#580) 2021-04-07 11:37:28 +03:00
Daniel Sears
cd9ef6cdd4 compatibility matrix doc change for new django-stubs version (#581) 2021-04-03 11:29:16 +03:00
Edwin Grubbs
8f97bf880d MIMEBase parameter for EmailMessage.attach() (#577)
* MIMEBase parameter for EmailMessage.attach()

* Added test_mail.yml

Co-authored-by: Edwin Grubbs <edwin.grubbs@motiva.com>
2021-04-02 00:21:21 +03:00
Anton Agestam
124d90794c Fix Field arguments variance (#573)
* Fix Field arguments variance

* fixup! Fix Field arguments variance

Test field can be used as bsse type
2021-03-07 13:32:56 +03:00
James Owen
6a6fd47f28 Tweak the constructor signature for ManyToManyField (#571)
Prior to this change, ManyToManyField was declared as being generic in
_ST and _GT, but also used the _T Typevar in its __init__ signature.
This caused mypy to add _T to the variables it was generic in when used
as an alias.

The symptom of this problem was that mypy would show an error with the
message "Type application has too few types (3 expected)" where a
ManyToManyField alias was declared, but adding an extra argument would
fail because the type only takes two arguments.

This change brings the signature of ManyToManyField in line with
ForeignKey and OneToOneField.
2021-03-04 12:23:13 +03:00
melvyn-oviavo
54e5ecc16a feat(add-get-lines): Add get_inlines method (#570)
Document ModelAdmin.get_inlines(). Available since Django 3.0.
2021-02-22 11:54:35 +03:00
Seth Yastrov
418437b00c Mention issue about as_manager along with a workaround (#569)
* Mention issue about as_manager along with a workaround

* Update README.md

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2021-02-18 09:56:09 +03:00
Daniel
eb195b61e9 Correct order for FileField __init__ args (#568) 2021-02-15 13:38:04 +03:00
Thomas Krapp
993dd816a4 Update static.pyi (#566)
* Update static.pyi

Parameters document_root and show_indexes should be marked as Optional since they have a default value.

* Update static.pyi

Correct signature of serve function.
2021-02-13 00:27:12 +03:00
Chas Nelson
e6dcfe4fc6 fix: add headers to http.HttpResponseBase constructor (#564)
* fix: add headers to http.HttpResponseBase constructor

fixes #563

* fix: correct Dict() with Dict[]

* feat: add ResponseHeaders typing

* fix: correct HttpResponseBase.headers type

* fix: add missing ...s

* fix: add CaseInsensitiveMapping import

* fix: make Dict -> Dict[str, str]
2021-02-09 22:07:35 +03:00
Simon Charette
8f9e77ce39 Allow ModelAdmin.actions to be set to None. (#560)
`None` is an allowed value to disable all actions for a particular `ModelAdmin`.
2021-01-31 10:24:32 +03:00
Tim Martin
a1334a70b9 Stricter return type annotations for template.Library (#541)
* Stricter return type annotations for template.Library

* Add some unit tests for the template library decorators
2021-01-20 23:11:02 +03:00
Nicolas Delaby
a8d8561d0e Add deferrable argument to unique constraint (#472) 2021-01-20 11:04:38 +03:00
Yuta Okamoto
bdc7db1154 Add algorithm parameter (Django 3.1) (#489)
* add algorithm parameter

* add algorithm field

* reformat
2021-01-20 11:03:51 +03:00
Maksim Kurnikov
49ed9c957f Merge pull request #536 from wkschwartz/patch-1
Fix incorrect and add missing annotations for loaddata command
2021-01-20 02:31:04 +03:00
Maksim Kurnikov
4829ce2200 Merge pull request #510 from jpulec/patch-1
Add resolve_callables to db.models.utils (Django 3.1)
2021-01-20 02:20:35 +03:00
Maksim Kurnikov
9fe1a76779 Merge pull request #559 from mkurnikov/value-to-string
add value_to_string method to Field
2021-01-20 02:18:20 +03:00
Maksim Kurnikov
153613eddb run black 2021-01-20 02:11:37 +03:00
Maksim Kurnikov
b6cb50e729 Merge pull request #538 from bullfest/av/ModelMultipleChoiceField
Make queryset parameter to ModelMultipleChoiceField.__init__ Optional
2021-01-20 02:02:01 +03:00
Maksim Kurnikov
344dea06b5 value_to_string obj param is Model 2021-01-20 01:58:29 +03:00
Maksim Kurnikov
01a9ad12e1 Merge pull request #533 from woochica/master
Add support for PositiveBigIntegerField (Django 3.1)
2021-01-20 00:19:13 +03:00
Maksim Kurnikov
0a0e1985d7 add value_to_string method to Field 2021-01-20 00:14:15 +03:00
Maksim Kurnikov
f07477260f Merge pull request #558 from mkurnikov/jsonfield
Missing Django 3.1 items
2021-01-20 00:10:24 +03:00
Maksim Kurnikov
11c3f8cd11 add django 3.1 classproperty 2021-01-19 22:16:12 +03:00
Maksim Kurnikov
159f8b95ba add django 3.1 jsonfield 2021-01-19 22:13:36 +03:00
Anas
58c087f7f5 Added cache in github actions to speed up CI (#549) 2020-12-22 23:37:41 +03:00
markedwards
2e9adce5eb Add Field to django_stubs_ext.django_stubs_ext.patch._need_generic (#547) 2020-12-22 10:09:29 +03:00
markedwards
47bd07758b Update django_stubs_ext documentation to reference settings (#548) 2020-12-19 11:50:46 +03:00
Marti Raudsepp
36d1778e2a Django admin additions (#543) 2020-12-17 13:23:51 +03:00
proxi
caaa23ab8f convince mypy that user.is_staff (and friends) are booleans (#542)
closes #512

Co-authored-by: proxi <51172302+3n-k1@users.noreply.github.com>
2020-12-16 23:28:01 +03:00
Marcin Wieczorek
cfd9379b58 Change patch_response_headers argument to Optional[int] (Fixes #337) (#338) 2020-12-13 16:21:58 +03:00
Alexander Viklund
362342d998 Make queryset parameter to ModelMultipleChoiceField Optional 2020-12-09 17:12:54 +01:00
William Schwartz
d3ff5415db Finish loaddata.pyi
This incorporates all type information I could glean from loaddata at
django/django@adb40d217e.

- Remove `help` per review comment:
  https://github.com/typeddjango/django-stubs/pull/536#discussion_r533179013
- Add `exclude_models` and `exclude_apps` based on the return type of
  `..utils.parse_apps_and_model_labels`.
- Change `loaddata`'s `fixture_labels` to `Sequence` of `str` instead of
  `Iterable` because in practice it's a tuple, but at a type level, the
  important thing is that `loaddata` iterates over `fixture_labels` more than
  once. General iterables (which include iterators) need not support iteration
  more than once.
- Correct the return type of `parse_name` to account for the possibility that
  the data and compression formats are `None`.
- Correct the return type of `find_fixtures` to be a list of the same type that
  `parse_name` returns.
- Add a type annotation for `SingleZipReader.read`. Django implements the method
  in a way that actually conflicts with `zipfile.ZipFile.read`'s type. This
  necessitates a `type: ignore[override]` to keep the tests passing. Mypy is
  correct that there is an override error, but Django's code is what it is.
  (And that method's signature was introduced way back in Django version 1.1,
  commit django/django@089ab18c025917f38a2e3731ae4024d4810df1ec.)
2020-12-01 11:32:59 -06:00
William Schwartz
eecf13a2fe Fix loaddata.pyi
- Added some of the instance attributes from command arguments: ignore, using, app_label, verbosity, format.
- Added class attribute: help.
- Fixed return type of find_fixtures.
2020-12-01 00:42:56 -06:00
Lysandros Nikolaou
d9c851abce Do not force django.contrib.* dependencies (#535)
* Do not force django.contrib.* dependencies

Fixes #428.
Fixes #534.

* Add one more test with contenttypes installed, but auth not
2020-11-24 14:38:03 +03:00
Torok Gabor
896cbe4752 Add support for PositiveBigIntegerField (Django 3.1) 2020-11-20 08:28:13 +01:00
Alisue
f3e0872d6e Fix signature of RemoteUserBackend.configure_user (#532)
* Fix signature of RemoteUserBackend.configure_user

The function signature has changed from 2.1 on 2.2 but django-stubs did not follow that.

https://github.com/django/django/blob/2.1.15/django/contrib/auth/backends.py#L163
https://github.com/django/django/blob/2.2/django/contrib/auth/backends.py#L177

* Use HttpRequest on request to make it more explicit
2020-11-19 18:38:59 +03:00
javulticat
4cb13a6ac5 AttributeError exception in copy_method_to_another_class (#531)
* Fix for method_node having no arguments

* Trim whitespace
2020-11-17 10:24:59 +03:00
Nikita Sobolev
19d695b1da Update misspel.yml 2020-11-17 10:15:18 +03:00
sobolevn
16326e999c Fixes CI 2020-11-14 21:18:09 +03:00
sobolevn
517ae648e5 Adds more types to patch 2020-11-14 20:46:32 +03:00
sobolevn
3e0f144148 Fixes README 2020-11-14 20:05:36 +03:00