Ashish Bansal (mrphantom)
92c8dfc93f
Fix wrong BaseCache typings ( #363 )
...
django.core.cache.backends.base.BaseCache were invalid. This commit
fixes them in accordance with [0].
[0] 447980e72a/django/core/cache/backends/base.py (L108)
2020-04-24 12:44:55 +03:00
Jorgen Phillips
c10c55052c
Add add_to_class method to Model ( #361 )
...
* Add add_to_class method to Model
* Fix @classmethod decorator
2020-04-24 01:11:16 +03:00
Sergey Tikhonov
96914e466b
Annotate AdminForm.__init__ ( #359 )
2020-04-16 18:22:21 +03:00
Onyeka Aghanenu
90ed7f332d
Fix Modelform auto_id to accept Boolean type. ( #356 )
2020-04-13 19:04:18 +03:00
Kacper
a801501151
stub for _build_app_dict ( #351 )
...
Co-authored-by: Kacper Szmigiel <szmigielkacper@gmai.com >
2020-04-04 20:38:42 +03:00
Sid Mitra
8ea59985df
Add RESTRICT and RestrictedError to django.db.models.deletion ( #345 )
...
* Add RESTRICT and RestrictedError to django.db.models.deletion
* Add black fomatting changes
2020-04-03 17:02:34 +03:00
Ceesjan Luiten
2964ed53d7
Improve type of BaseForms.files ( #350 )
...
This is valid Django, which failed to pass with the old type-defintion:
class MyForm(Form):
myparam = MultiFileField(...)
self.clean(self, *args, **kwargs):
self.files.getlist('myparam', [])
2020-03-31 10:16:02 +03:00
Stevan Milic
1b9176f994
Add state attribute to Model ( #347 ) ( #348 )
...
Add from_db method to Model
Co-authored-by: Stevan Milic <stevan.milic@tradecore.com >
2020-03-30 10:35:40 +03:00
Nikita Sobolev
54d0d018c6
Minor type improvements after linting ( #343 )
2020-03-19 18:04:51 +03:00
Marti Raudsepp
afa16bfb74
Make decorator functions transparent to Mypy ( #306 )
...
By declaring return type as -> Callable[[_C], _C], Mypy can infer that
the decorated function has also the same arguments and return type as
the original.
View functions are constrained to return HttpResponseBase (or any
subclass of it).
Also added typecheck test coverage to most of the cases.
2020-03-12 00:32:30 +03:00
Kevin Marsh
fe3b95c611
Fix input types of humanize functions ( #335 )
2020-02-27 10:10:53 +03:00
Daniel Hillier
d0f9730c53
Add db.models.fields.Field method stubs for custom Fields ( #331 )
...
Add stubs for: pre_save, get_db_prep_value, get_db_prep_save
2020-02-17 10:08:39 +03:00
Semyon Pupkov
2397065fa6
signing.loads allows use timedelta for max_age ( #325 )
...
* signing.loads allows use timedelta
https://github.com/django/django/blob/stable/2.2.x/django/core/signing.py#L191
* fix black
2020-02-14 14:12:58 +03:00
Marti Raudsepp
95e6c94319
Improve test client type stubs ( #322 )
...
* Added missing `follow: bool` argument to Client request methods.
* Annotated return types as `HttpResponse` instead of `Any`.
* Made `Client` class inherit from `RequestFactory`, as it does in Django.
* Changed `json()` return type to Any, as it can also be a list.
Wrt (2), these return types were reverted from `HttpResponse` to `Any`
in commit 287c64d6fb . But I suspect that
was simply to silence mypy warnings about "incompatible with supertype
RequestFactory", not because there were any issues with the annotation.
Note that `Client.request()` monkey-patches the `HttpResponse` object
with some additional attributes. Those attributes were already annotated
before, I reordered and added additional comments to make it clear where
they come from.
2020-02-12 18:44:17 +03:00
Brian Helba
d96aee7a8b
Fix the type of form.Field.widget ( #321 )
...
The `widget` class attribute of `form.Field` expects a `Widget` class, not an instance of `Widget`.
See: https://docs.djangoproject.com/en/3.0/ref/forms/fields/#widget
Also usages at: 3259983f56/django/forms/fields.py (L46)
2020-02-07 12:42:02 +03:00
Vince Salvino
5b3088a17a
Fix cache arg type for django.utils.cache.learn_cache_key() ( #316 )
2020-02-01 22:03:46 +03:00
Konstantin Alekseev
f89a0fbbaa
Cleanup checks framework ( #310 )
2020-01-30 14:38:23 +03:00
Tatsh
438f8b5829
Add OutputWrapper write() signature ( #301 )
...
* Add OutputWrapper write() signature
* Add #type: ignore[override] to OutputWrapper write() signature
2020-01-28 01:34:13 +03:00
Joseph Kahn
836d5acd8f
Allow error handlers to be strings ( #307 )
...
Based on the docs on this page: https://docs.djangoproject.com/en/3.0/ref/urls/
2020-01-28 01:33:49 +03:00
Cesar Canassa
bfae51e64c
Added manager _db ( #296 )
2020-01-14 17:05:29 +03:00
Daniel Hillier
e3801918e3
Fix incorrect type for django.core.files.File.file ( #293 ) ( #294 )
2020-01-11 14:27:46 +03:00
Marti Raudsepp
6f296b0a91
Implement @cached_property attribute inference ( #292 )
2020-01-10 13:57:09 +03:00
Nikita Sobolev
7ba578f6b2
Refactors validators types ( #284 )
...
* Update __init__.pyi
* It should not fail right now 🤔
* Refactor validators a bit
* Fixes CI
* Update __init__.pyi
2019-12-21 15:44:26 +03:00
Marti Raudsepp
fb1593630a
Expand stubs for django.core.management.color ( #276 )
...
Many attributes were previously missing; 'DEBUG' and 'INFO' attributes
were never supported by Django.
2019-12-16 20:16:21 +03:00
JR Heard
031d42a75d
update ChoiceField's choices kwarg's annotation ( #273 )
...
per the [docs](https://docs.djangoproject.com/en/3.0/ref/forms/fields/#choicefield ), `choices` is:
> Either an iterable of 2-tuples to use as choices for this field, or a callable that returns such an iterable.
2019-12-14 09:30:50 +03:00
Maksim Kurnikov
d0c25e3bce
Allow to run from_queryset() with BaseManager, Manager ( #271 )
...
* allow to run from_queryset() with BaseManager, Manager
* fix tests
2019-12-13 20:16:33 +03:00
Maksim Kurnikov
1c31e71ffc
enable 'model_forms' for tests typechecking ( #270 )
2019-12-13 13:30:21 +03:00
Dmitry Groshev
6b3b6be3c1
add .model field to _BaseQuerySet ( #268 )
2019-12-12 21:50:59 +03:00
Maksim Kurnikov
f02050911f
various annotation improvements ( #258 )
2019-12-12 06:42:29 +03:00
henribru
e8e6fca78c
Fix return type of refresh_from_db ( #244 )
2019-12-12 05:36:11 +03:00
Hannes Ljungberg
eba3f6cb15
Update django.contrib.auth with Django 3.0 compatibility ( #256 )
...
* Add support for BaseBackend
* Add User.get_user_permissions
* Add support for UserManager.with_perm
* Add support for reset_url_token
2019-12-11 01:10:10 +03:00
Maksim Kurnikov
8c2de7da56
add a number of django test directories for typecheck ( #257 )
2019-12-11 00:51:32 +03:00
Maksim Kurnikov
d43c6dc7e2
Merge pull request #254 from mkurnikov/better-force-text-types
...
Better types for django.utils.encoding
2019-12-10 23:36:38 +03:00
Maxim Kurnikov
f7e2109e06
add @overload clauses to smart_text, smart_bytes, force_bytes
2019-12-10 23:22:23 +03:00
Hannes Ljungberg
cea62abf5a
Add support for database functions introduced in 3.0 ( #253 )
...
* Add support for hash database functions
* Add support for Sign
2019-12-10 22:36:11 +03:00
Hannes Ljungberg
3b69ec6a72
Add support for RangeBoundary ( #252 )
2019-12-10 22:09:55 +03:00
Seth Yastrov
7e794534c0
Better type for force_text using overloads/Literal
...
- If a str is passed in, it returns a str.
- If strings_only = True and a "protected type" is passed in, returns that type.
- Default if it doesn't match the overloads: return a str
2019-12-10 21:28:40 +03:00
Hannes Ljungberg
f5f33b061d
Add support for exclusion constraints ( #249 )
2019-12-10 20:50:28 +03:00
Ran Benita
58b26fdbd3
Improve TestCase.assertNumQueries type ( #250 )
2019-12-10 19:37:13 +03:00
Youssef Moussaoui
9ca79c24a2
Move BLANK_CHOICE to django.db.models.fields ( #242 )
2019-12-08 08:19:24 +03:00
Maksim Kurnikov
4ac43c6ed6
Add Django 3.0 testing to CI ( #246 )
...
* add Django 3.0 testing to CI
* remove importlib_metadata usage
* conditionally load choices module for tests
2019-12-06 23:36:24 +03:00
Konstantin Alekseev
041754f817
Fix smtp backend open ( #240 )
2019-12-01 20:46:11 +03:00
Konstantin Alekseev
c0c5d1e588
Cleanup EmailMessage types ( #208 )
...
* Cleanup EmailMessage types
* Typecheck email module tests.
2019-12-01 17:14:16 +03:00
Youssef Moussaoui
58f1833cab
Declare is_relation and related_model on Field ( #230 )
2019-11-30 22:40:22 +03:00
Konstantin Alekseev
cbc7159995
Support mypy 0.750
2019-11-30 13:39:28 +03:00
Patrick Gingras
df4c17a947
added base_fields and declared_fields properties to Form ( #235 )
2019-11-27 22:48:05 +03:00
Anthony Ricaud
557b7a4fa3
Add new View.setup method introduced in Django 2.2 ( #233 )
...
https://docs.djangoproject.com/en/2.2/ref/class-based-views/base/#django.views.generic.base.View.setup
https://github.com/django/django/blob/2.2/django/views/generic/base.py#L83-L87
2019-11-20 23:49:38 +03:00
Maksim Kurnikov
8343d76895
Fix has_perm() methods for auth backend, and for contrib.auth.models ( #232 )
...
* fix has_perm() methods
* lint
2019-11-19 04:54:17 +03:00
Maksim Kurnikov
8d986a0f43
remove catch-all __getattr__ for Manager, fix some issues with manager methods ( #227 )
2019-11-12 20:36:07 +03:00
Pilifer
e9a90ebff0
More precise annotations of utils.timezone functions that return instances of tzinfo subclasses. ( #209 )
...
* fix annotations of utils.timezone
* use intermediary tzinfo subclass exposed in pytz typeshed
* fix annotations of get_fixed_timezone as it returns datetime.timezone in Django 2.2
* add explanatory comment to get_current_timezone annotations
* black utils.timezone.pyi
2019-11-12 18:27:54 +03:00