title: Django Model Form - Unable to update table with foreign key
body: <p>This is my forms.py snippet</p>
  
  <pre><code>class ContactForm(forms.ModelForm):
      class Meta:
          model = Contact
          exclude = ('user',)
  </code></pre>
  
  <p>This is my views.py snippet</p>
  
  <pre><code>def contact(request, template_name):
      if request.method == "POST":
          form = ContactForm(request.POST)
          if form.is_valid():
              obj = form.save(commit=False)
              obj.user = request.user
              obj.save()
              return HttpResponseRedirect('/newuser/step2/')
      else:
          if (Contact.objects.filter(user=request.user)):
              contact_obj = Contact.objects.get(user_id=request.user.id)
              form = ContactForm(instance = contact_obj)
          else:
              form = ContactForm()
  
      return render_to_response(template_name, RequestContext(request, {'form' : form}))
  </code></pre>
  
  <p>When i fill the data for the first time for a registered user, data successfully goes into the table. When i visit the form again, data from database is loaded, but when re-submit, below errors come</p>
  
  <pre><code>Exception Type: IntegrityError
  Exception Value:    (1062, "Duplicate entry '3' for key 'user_id'")
  Exception Location: /usr/lib/python2.7/dist-packages/MySQLdb/connections.py in defaulterrorhandler, line 36
  </code></pre>
  
  <p>My contact table has the automatically generated 'id' field as primary key, while 'user_id' is the foreign key field. '3' is the 'user_id' for logged in user.</p>
  
  <p>I am trying to do a very simple thing, store some data for user in a table and link it. Is there a better way to do it? What is it that I am doing wrong here?</p>