From 6355464230548fff50b498619ea43513376000d9 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sun, 28 Jul 2024 10:04:55 +0200 Subject: [PATCH] Add type guard --- .../{{cookiecutter.project_slug}}/users/views.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py index 942f3e3f..8bb1838c 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py @@ -35,6 +35,8 @@ class UserUpdateView(LoginRequiredMixin, SuccessMessageMixin, UpdateView): return self.request.user.get_absolute_url() def get_object(self, queryset: QuerySet | None=None) -> User: + # for mypy to know that the user is authenticated + assert self.request.user.is_authenticated return self.request.user