mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-06 12:14:28 +08:00
Update README.md
This commit is contained in:
10
README.md
10
README.md
@@ -55,20 +55,20 @@ We rely on different `django` and `mypy` versions:
|
|||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
> Is this an official Django project?
|
### Is this an official Django project?
|
||||||
|
|
||||||
No, it is not. We are indendepent from Django at the moment.
|
No, it is not. We are indendepent from Django at the moment.
|
||||||
There's a [proposal](https://github.com/django/deps/pull/65) to merge our project into the Django itself.
|
There's a [proposal](https://github.com/django/deps/pull/65) to merge our project into the Django itself.
|
||||||
You show your support by linking the PR.
|
You show your support by linking the PR.
|
||||||
|
|
||||||
> Is it safe to use this in production?
|
### Is it safe to use this in production?
|
||||||
|
|
||||||
Yes, it is! This project does not affect your runtime at all.
|
Yes, it is! This project does not affect your runtime at all.
|
||||||
It only affects `mypy` type checking process.
|
It only affects `mypy` type checking process.
|
||||||
|
|
||||||
But, it does not make sense to use this project without `mypy`.
|
But, it does not make sense to use this project without `mypy`.
|
||||||
|
|
||||||
> mypy crashes when I run it with this plugin installed
|
### mypy crashes when I run it with this plugin installed
|
||||||
|
|
||||||
Current implementation uses Django runtime to extract models information, so it will crash, if your installed apps `models.py` is not correct. For this same reason, you cannot use `reveal_type` inside global scope of any Python file that will be executed for `django.setup()`.
|
Current implementation uses Django runtime to extract models information, so it will crash, if your installed apps `models.py` is not correct. For this same reason, you cannot use `reveal_type` inside global scope of any Python file that will be executed for `django.setup()`.
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ In other words, if your `manage.py runserver` crashes, mypy will crash too.
|
|||||||
You can also run `mypy` with [`--tb`](https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-show-traceback)
|
You can also run `mypy` with [`--tb`](https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-show-traceback)
|
||||||
option to get extra information about the error.
|
option to get extra information about the error.
|
||||||
|
|
||||||
> I cannot use QuerySet or Manager with type annotations
|
### I cannot use QuerySet or Manager with type annotations
|
||||||
|
|
||||||
You can get a `TypeError: 'type' object is not subscriptable`
|
You can get a `TypeError: 'type' object is not subscriptable`
|
||||||
when you will try to use `QuerySet[MyModel]` or `Manager[MyModel]`.
|
when you will try to use `QuerySet[MyModel]` or `Manager[MyModel]`.
|
||||||
@@ -87,7 +87,7 @@ There are several things you can use strings instead: `'QuerySet[MyModel]'` and
|
|||||||
|
|
||||||
Currently we [are working](https://github.com/django/django/pull/12405) on providing `__class_getitem__` to the classes where we need them.
|
Currently we [are working](https://github.com/django/django/pull/12405) on providing `__class_getitem__` to the classes where we need them.
|
||||||
|
|
||||||
> How can I use HttpRequest with custom user model?
|
### How can I use HttpRequest with custom user model?
|
||||||
|
|
||||||
You can subclass standard request like so:
|
You can subclass standard request like so:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user