Add an assertion to fix mypy type error (#3150)

Co-authored-by: Bruno Alla <alla.brunoo@gmail.com>
This commit is contained in:
Arnav Choudhury 2021-11-25 23:40:33 +05:30 committed by GitHub
parent e422cbc084
commit 0790929e7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,7 +25,10 @@ class UserUpdateView(LoginRequiredMixin, SuccessMessageMixin, UpdateView):
success_message = _("Information successfully updated")
def get_success_url(self):
return self.request.user.get_absolute_url() # type: ignore [union-attr]
assert (
self.request.user.is_authenticated
) # for mypy to know that the user is authenticated
return self.request.user.get_absolute_url()
def get_object(self):
return self.request.user