mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-10 14:01:56 +08:00
Update django_stubs_ext documentation to reference settings (#548)
This commit is contained in:
@@ -90,12 +90,12 @@ Install it:
|
|||||||
pip install django-stubs-ext # as a production dependency
|
pip install django-stubs-ext # as a production dependency
|
||||||
```
|
```
|
||||||
|
|
||||||
And then place in your `manage.py`, `wsgi.py`, and `asgi.py` files:
|
And then place in your top-level settings:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
import django_stubs_ext
|
import django_stubs_ext
|
||||||
|
|
||||||
django_stubs_ext.monkeypath()
|
django_stubs_ext.monkeypatch()
|
||||||
```
|
```
|
||||||
|
|
||||||
2. You can use strings instead: `'QuerySet[MyModel]'` and `'Manager[MyModel]'`, this way it will work as a type for `mypy` and as a regular `str` in runtime.
|
2. You can use strings instead: `'QuerySet[MyModel]'` and `'Manager[MyModel]'`, this way it will work as a type for `mypy` and as a regular `str` in runtime.
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ In your Django application, use the following code:
|
|||||||
```py
|
```py
|
||||||
import django_stubs_ext
|
import django_stubs_ext
|
||||||
|
|
||||||
django_stubs_ext.monkeypath()
|
django_stubs_ext.monkeypatch()
|
||||||
```
|
```
|
||||||
|
|
||||||
This only needs to be called once, so the call to `monkeypatch` should be placed in your top-level urlconf.
|
This only needs to be called once, so the call to `monkeypatch` should be placed in your top-level settings.
|
||||||
|
|
||||||
## Version compatibility
|
## Version compatibility
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user