title: Django edit template for ModelForm is not being filled in with values
body: <hr>
  
  <p>I have a ModelForm that I have created a view and template with to add an instance to the database. I am now trying to extend this to be editable when the user clicks a button - but when they do that the form/template page appears and I get the "This Field is required message" but all fields are empty instead of pre-populated with the instance I passed in, but when I edit the values to something different than originally then in my database the correct instance is updated. So it is passing the primary key but none of the values are showing up. If anyone can tell what I am doing wrong I would appreciate it, oh, and I am using this post <a href="https://stackoverflow.com/questions/1854237/django-edit-form-based-on-add-form/1854453#1854453">Django edit form based on add form?</a> as a basis so please don't just send me there.</p>
  
  <p>Here are my files</p>
  
  <p><strong>ModelForm</strong></p>
  
  <pre><code>class CreditCardForm(forms.ModelForm):
  class Meta:
      model = CreditCard
      fields = ('name_on_card','card_number','contact_number_on_card')
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>def edit(request, id=None, template_name='article_edit_template.html'):
  if id:
      print "Edit Mode"
      card = get_object_or_404(CreditCard, pk=id)
      if card.card_owner != request.user:
          raise HttpResponseForbidden()
  else:
      print "Create Mode"
      card = CreditCard(card_owner=request.user)
  
  if request.POST:
      print "request.POST"
      form = CreditCardForm(request.POST, instance=card)
      if form.is_valid():
          print "is_valid()"
          form.save()
  
          # If the save was successful, redirect to another page
          # redirect_url = reverse(article_save_success)
          return HttpResponseRedirect('/cards/')
  else:
      print "else"
      form = CreditCardForm(instance=card)
  
  return render_to_response(
      'create_credit.html', 
      {'form': form,},
      context_instance=RequestContext(request)
  )
  </code></pre>
  
  <p><strong>Template</strong></p>
  
  <pre><code>{% include "base.html" %}
  
  &lt;form action="" method="post"&gt;{% csrf_token %}
  &lt;fieldset&gt;
  &lt;legend&gt;Required&lt;/legend&gt;
  
  &lt;div class="fieldWrapper"&gt;
      {{ form.name_on_card.errors }}
      &lt;label for="id_topic"&gt;Name as it appears on card:&lt;/label&gt;
      {{ form.name_on_card }}
  &lt;/div&gt;
  &lt;div class="fieldWrapper"&gt;
      {{ form.card_number.errors }}
      &lt;label for="id_topic"&gt;Last 6 digits of card number:&lt;/label&gt;
      {{ form.card_number }}
  &lt;/div&gt;  
  &lt;/fieldset&gt;
  
  &lt;fieldset&gt;
  &lt;legend&gt;Optional&lt;/legend&gt;
  &lt;!-- This is for Credit Card's Only --&gt;
  &lt;div class="fieldWrapper"&gt;
      {{ form.contact_number_on_card.errors }}
      &lt;label for="id_topic"&gt;Institution contact number: 1-&lt;/label&gt;
      {{ form.contact_number_on_card }}
  &lt;/div&gt;
  &lt;/fieldset&gt;
  &lt;p&gt;&lt;input type="submit" value="Save"&gt;&lt;/p&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>URLS</strong></p>
  
  <pre><code>    url(r'^new/credit/$', views.edit, {}, 'crds_newCredit'),
  url(r'^edit/credit/(?P&lt;id&gt;\d+)/$', views.edit, {}, 'crds_editCredit'),
  </code></pre>