Add an assertion to fix mypy type error
@@ -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
