mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-09 05:24:53 +08:00
Update README.md
This commit is contained in:
14
README.md
14
README.md
@@ -87,6 +87,20 @@ 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.
|
||||
|
||||
> How can I use HttpRequest with custom user model?
|
||||
|
||||
You can subclass standard request like so:
|
||||
|
||||
```python
|
||||
from django.http import HttpRequest
|
||||
from my_user_app.models import MyUser
|
||||
|
||||
class MyRequest(HttpRequest):
|
||||
user: MyUser
|
||||
```
|
||||
|
||||
And then use `MyRequest` instead of standard `HttpRequest` inside your project.
|
||||
|
||||
|
||||
## Related projects
|
||||
|
||||
|
||||
Reference in New Issue
Block a user