Add type guard

This commit is contained in:
Bruno Alla 2024-07-28 10:04:55 +02:00
parent a8105bdc9f
commit 6355464230
No known key found for this signature in database

View File

@ -35,6 +35,8 @@ class UserUpdateView(LoginRequiredMixin, SuccessMessageMixin, UpdateView):
return self.request.user.get_absolute_url() return self.request.user.get_absolute_url()
def get_object(self, queryset: QuerySet | None=None) -> User: 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 return self.request.user