Use self.request.user instead of second query
@@ -27,7 +27,7 @@ class UserUpdateView(LoginRequiredMixin, UpdateView):
return reverse("users:detail", kwargs={"username": self.request.user.username})
def get_object(self):
- return User.objects.get(username=self.request.user.username)
+ return self.request.user
def form_valid(self, form):
messages.add_message(
