Commit Graph

656 Commits

Author SHA1 Message Date
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
Nikita Sobolev
8a68111ce5 Closes #529 (#530)
* Closes #529

* Fixing CI

* Fixing CI

* new monorepo setup
2020-11-14 20:03:50 +03:00
sobolevn
9f966a8056 django_stubs_ext release 0.1.0 2020-11-14 19:17:38 +03:00
proxy
0c41d0c6e9 create monkeypatching function for adding get_item dunder (#526)
* run black

* create monkeypatching function for adding get_item dunder

* whoops i forgot the test

* change the name in INSTALLED_APPS to make test pass

* turn the whole thing into a proper package

* move django_stubs_ext to requirements.txt

* also install requirements.txt

* attempt to fix pre-commit

* numerous small code review fixes

* fix dependency issues

* small dependency fixes

* configure proper license file location

* add the rest of the monkeypatching

* use strict mypy

* update contributing with a note monkeypatching generics

* copy release script from parent package
2020-11-11 10:04:13 +03:00
Tim Martin
e798b496c0 Add stubs for remaining commands in django.core.management.commands (#525)
* Add stubs for remaining commands in django.core.management.commands

* Tighten up stub definitions in django.core.management.commands

* Apply some missing declarations in django.core.management.commands
2020-11-11 01:56:41 +03:00
Francesc
01af2ff588 Annotate get_asgi_application (#527) 2020-11-09 20:27:17 +03:00
proxy
aab8acf2ea change get_user to use a protocol requiring a session (#522)
* change get_user to use a protocol requiring a session
define a "_HasSession" protocol, and update contrib.auth.get_user to use it
get_user only requires a session field, and idiomatic django testing frequently calls get_user with a TestClient

* run black

* use union for get_user instead of a protocol

* create tests for get_user typechecking

* properly import test client
2020-11-07 11:38:45 +03:00
Clarity
1c4a7d25c7 Add Point and Polygon to contrib.gis.geos (#524) 2020-11-07 01:34:47 +03:00
Robert Huselius
a0d61c0de3 Change InlineModelAdmin.formset to Type[BaseInlineFormSet] (#521)
* Change InlineModelAdmin.formset to Type[BaseInlineFormSet]

* More exact annotations + add NaturalTimeFormatter

* Correction: cls type is Type[...]

* Complete annotations for PasswordResetTokenGenerator

* fix *gettext*_lazy annotations
2020-11-06 11:04:34 +03:00
Ceesjan Luiten
e837dac26a Fix ResourceWarning (#520) 2020-11-05 16:47:41 +03:00
Yanky Hoffman
bbdf15a6ec Add is_active field to django.contrib.auth.AbstractBaseUser model (#517)
* Add `is_active` field to `django.contrib.auth.AbstractBaseUser` model

* Favor defining type than setting concrete value

* Update type to reflect sub-class implementation
2020-11-03 18:07:45 +03:00
proxy
f08b428027 make FormMixin generic to allow proper typing for LoginView (#515)
closes #514
2020-10-31 21:53:45 +03:00
Na'aman Hirschfeld
44151c485d updated package setup (#485)
* updated package setup

* updated to use python 3.9

* fixed test runner

* fixed typecheck tests

* fixed discrepencies

* added override to runner

* updated travis

* updated pre-commit hooks

* updated dep
2020-10-29 11:59:48 +03:00
Brian Helba
a3624dec36 Provide a more specific signature for django.core.checks.register (#509)
This also corrects the fact that "run_checks" only returns a concatenated list
of all registered check results, which may only contain CheckMessage:
302caa40e4/django/core/checks/registry.py (L60)
2020-10-29 10:31:26 +03:00
James Pulec
9a9a0123c7 Fix Generator Type 2020-10-28 21:33:43 -07:00
James Pulec
d3d854dac8 Add resolve_callables to db.models.utils 2020-10-28 20:27:46 -07:00
Brian Helba
6dc2c32382 Ensure that all registered checks take the same parameters (#499)
The Django API requires that registered checks take an "app_configs"
argument, which is a list of AppConfig. This is practically also passed by
keyword, so all parameters should be specified with a "= ..." to indicate
that they are keywords.

Django always passed "app_configs" as a list, but checks can accept and
use a more general more Sequence.

The Django API also requires that registered checks take "**kwargs".

This results in the canonical parameters of:
"app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any"
2020-10-29 02:21:32 +03:00
Brian Helba
695cdb16ca Add django.forms.widgets.FILE_INPUT_CONTRADICTION symbol (#506)
302caa40e4/django/forms/widgets.py (L399)
2020-10-29 02:20:40 +03:00
sobolevn
cb1fa08a82 Version 1.7.0 released 1.7.0 2020-10-28 11:41:15 +03:00
proxy
e2f6abe579 add additional failing test for ModelAdmin generic (#505)
this will ensure that the generic constraint holds
2020-10-28 10:28:04 +03:00
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