mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-08 13:04:47 +08:00
fix httprequest other fields
This commit is contained in:
@@ -205,7 +205,7 @@ class NewSemanalDjangoPlugin(Plugin):
|
|||||||
django_context=self.django_context)
|
django_context=self.django_context)
|
||||||
|
|
||||||
info = self._get_typeinfo_or_none(class_name)
|
info = self._get_typeinfo_or_none(class_name)
|
||||||
if info and info.has_base(fullnames.HTTPREQUEST_CLASS_FULLNAME):
|
if info and info.has_base(fullnames.HTTPREQUEST_CLASS_FULLNAME) and attr_name == 'user':
|
||||||
return partial(request.set_auth_user_model_as_type_for_request_user, django_context=self.django_context)
|
return partial(request.set_auth_user_model_as_type_for_request_user, django_context=self.django_context)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
main: |
|
main: |
|
||||||
from django.http.request import HttpRequest
|
from django.http.request import HttpRequest
|
||||||
reveal_type(HttpRequest().user) # N: Revealed type is 'myapp.models.MyUser'
|
reveal_type(HttpRequest().user) # N: Revealed type is 'myapp.models.MyUser'
|
||||||
|
# check that other fields work ok
|
||||||
|
reveal_type(HttpRequest().method) # N: Revealed type is 'Union[builtins.str, None]'
|
||||||
installed_apps:
|
installed_apps:
|
||||||
- myapp
|
- myapp
|
||||||
additional_settings:
|
additional_settings:
|
||||||
|
|||||||
Reference in New Issue
Block a user