title: Updating User model in Django with class based UpdateView
body: <p>I am trying to update the Django User model with the class based UpdateView that automatically renders with the current user but am getting an error that a pk or slug is required. The form work and renders with the proper current user context but throws the error when I try to submit the changes. Below is the view I am using:</p>
  
  <pre><code>class UserUpdateView(UpdateView):
      form_class = UserForm
      model = User
      template_name = 'members/user_update.html'
  
      def get(self, request, **kwargs):
          self.object = User.objects.get(username=self.request.user)
          form_class = self.get_form_class()
          form = self.get_form(form_class)
          context = self.get_context_data(object=self.object, form=form)
          return self.render_to_response(context)
  
      def form_valid(self, form):
          self.object = form.save(commit=False)
          self.object.user = self.request.user
          self.object.save()
          return HttpResponseRedirect(self.get_success_url())
  </code></pre>