From b846c0f2ede8da0157633245c7bb65e24925e0d4 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Thu, 6 Feb 2020 10:32:47 +0300 Subject: [PATCH] Update README.md --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 4221249..7836525 100644 --- a/README.md +++ b/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