fix httprequest other fields

This commit is contained in:
Maxim Kurnikov
2019-07-21 00:43:00 +03:00
parent d7d379e1cd
commit 39fb48b08a
2 changed files with 3 additions and 1 deletions

View File

@@ -205,7 +205,7 @@ class NewSemanalDjangoPlugin(Plugin):
django_context=self.django_context)
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)

View File

@@ -3,6 +3,8 @@
main: |
from django.http.request import HttpRequest
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:
- myapp
additional_settings: