Files
django-stubs/tests/typecheck/contrib
PIG208 516deba2fa Improve stubs with minor fixes (#1038)
* Add a missing attribute to Jinja2.

https://github.com/django/django/blob/main/django/template/backends/jinja2.py#L35

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

* Make _QuerySet.extra's signature more generic.

This makes sure that we don't reject tuples, which is also valid
according to the implementation.

Relevant source code:
https://github.com/django/django/blob/03eec9ff6cc78e7c1bcf88bb76ecd11f0d433c72/django/db/models/sql/where.py#L271-L281
https://github.com/django/django/blob/03eec9ff6cc78e7c1bcf88bb76ecd11f0d433c72/django/db/models/sql/query.py#L2307-L2308

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

* Fix user_passes_test to use AUTH_USER_MODEL.

According to the documentation, `test_func` is a callable that takes a
`User` (possibly anonymous).

Relevant documentation:
https://docs.djangoproject.com/en/4.0/topics/auth/default/#django.contrib.auth.decorators.user_passes_test

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

* Add more accurate type annotations for dirs.

Though not documented, it's possible for `dirs` to contain
`pathlib.Path`.

`django.template.loaders.app_directories.Loader` is an example for this:
https://github.com/django/django/blob/03eec9ff6cc78e7c1bcf88bb76ecd11f0d433c72/django/template/loaders/app_directories.py
https://github.com/django/django/blob/03eec9ff6cc78e7c1bcf88bb76ecd11f0d433c72/django/template/utils.py#L97-L111

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

* serve should return FileResponse.

There are several serve functions that should return a `FileResponse`.

Source code:
https://github.com/django/django/blob/863aa7541d30247e7eb7a973ff68a7d36f16dc02/django/views/static.py#L17-L53
https://github.com/django/django/blob/863aa7541d30247e7eb7a973ff68a7d36f16dc02/django/contrib/staticfiles/views.py#L15-L39
https://github.com/django/django/blob/863aa7541d30247e7eb7a973ff68a7d36f16dc02/django/contrib/staticfiles/handlers.py#L48-L50
https://github.com/django/django/blob/863aa7541d30247e7eb7a973ff68a7d36f16dc02/django/test/testcases.py#L1680-L1687

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-07-04 23:46:53 +03:00
..
2022-04-04 00:41:41 +03:00
2022-04-04 00:41:41 +03:00