title: Django Overwrite existing instance in table
body: <p>I'm creating a form in one page, then in another page I'm trying to pull out the form (populated with the data saved in it already) and would like to make changes to it so that when I save it it overwrites the instance instead of creating another one.</p>
  
  <pre><code>def edit(request):
  
     a = request.session.get('a',  None)
  
     if a is None:
         raise Http404('a was not found')
  
     if request.method == 'POST':
         form = Name_Form(request.POST, instance=a)
         if form.is_valid():
             j = form.save( commit=False )
             j.save()
     else:
         form = Name_Form( instance = a )
  </code></pre>
  
  <p>This is the code I have for the "editting form" view.. When I open this page the form is successfully prepopulated with all the data. However, when I make changes and save, it does not overwrite the existing instance, instead it creates a new one.</p>
  
  <p>Any ideas? </p>