title: Allow user to change its picture. Django
body: <p>In my app I allow users to have a profile picture. And I would like them to be able to change it. Surprisingly, I didn't find anything on how to accomplish that.</p>
  
  <p>Here is what I tried:</p>
  
  <p>models.py   </p>
  
  <pre><code>        class UserProfile(FacebookProfileModel):
             user = models.OneToOneField(User)
             profilepic = models.ImageField(upload_to="profilepics/", default="blabla.jpg")
  </code></pre>
  
  <p>my html:</p>
  
  <pre><code>       &lt;form method='post' action='{%url myproject.views.changes %}&gt;
         &lt;div class="controls"&gt;
         &lt;input type="file" name="image"&gt;
         &lt;/div&gt;
         &lt;input type="submit"&gt;
         &lt;/form&gt;
  </code></pre>
  
  <p>my view:</p>
  
  <pre><code>      def changes(request):
            if 'image' in request.POST:
               image = request.POST.get('image')
               userprofile.profilepic.url = image
               userprofile.save()
  </code></pre>
  
  <p>When I do that, I get the following error message: </p>
  
  <pre><code>       'AttributeError at /my/site/
          can't set attribute'
  </code></pre>
  
  <p>Any idea on how I could accomplish that? Thank you</p>