title: Django User Update Form and View
body: <p>I am very early on in my Django/Python development journey, most things I have been able to slowly figure out after a few hours/days of head scratching and trial/error. I now have the commonly asked question that I cannot get working correctly:</p>
  
  <p><strong>How Do I Create a User Profile Update View/Form?</strong></p>
  
  <p>I have hacked on several solutions from Stack Overflow, and just cannot figure out what I am doing wrong thus far. Here is the initial version of my poor attempt using Django 1.9: </p>
  
  <pre><code>#forms.py
  class profileForm(forms.ModelForm):
      class Meta:
          model = User
          fields = ['first_name', 'last_name', 'email']
  
  #views.py
  @login_required
  def profile(request):
      if request.method == 'POST':
          form = profileForm(data=request.POST, instance=request.user)
          update = form.save(commit=False)
          update.user = request.user
          update.save()
      else:
          form = profileForm(instance=request.user)
  
      return render(request, 'profile.html', {'form': form})
  
  #urls.py
  urlpatterns = [
      url(r'^dashboard/$', views.dashboard, name='dashboard'),
      url(r'^dashboard/profile$', views.profile, name='profile'),
  ]
  
  #profile.html
  &lt;form action="." method="post"&gt;
      {% csrf_token %}
      {{ form.as_p }}
      &lt;button type="submit"&gt;Update Profile&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>So the current behaviour of my update user profile view is to not update any of the specified fields in the form on POST, but the page does load to a different URL. For example the URL for the profile update form is <strong>/dashboard/profile</strong> which redirects to <strong>/dashboard</strong> on form submission. If I manually add email/first_name/last_name in the Django admin, it is displayed correctly in my form... I just cannot get it to save updated data.</p>
  
  <p>I did have a version of the above code that was giving me username errors also, which I am guessing might have been close to a solution? Eventually I would like to use the email address as the username, but I would like to figure that out for myself once I have an ultra-simple working profile update form.</p>
  
  <p>I apologise in advance for the silly question, I have Googled around and attempted other solutions but I either cannot get the same initial errors or cannot get a working version as detailed.</p>
  
  <p>Thanks all and have a great day/night!</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I have also tried this solution <a href="https://stackoverflow.com/questions/9957371/how-to-update-user-object-without-creating-new-one">How to update User object without creating new one?</a>, which also has the same behaviour: not update any of the specified fields in the form on POST, but the page does load to a different URL... which confuses me more, maybe the issue is with my urls.py instead?</p>