title: Where's the primary key of the object I want to update in django using modelform?
body: <p>I'm using modelform in django to insert and update objects in my database, but when I try to update I cannot see the primary key/id of the object being updated:</p>
  
  <p>My model:</p>
  
  <pre><code>class Category(models.Model):
      name = models.CharField(max_length=20, db_index = True)
  </code></pre>
  
  <p>and my form:</p>
  
  <pre><code>class CategoryForm(ModelForm):
      class Meta:
          model = Category
          fields = ['name']
  </code></pre>
  
  <p>and in my template I got:</p>
  
  <pre><code>{% csrf_token %}
  {{ category_form.as_p  }}
  </code></pre>
  
  <p>In my view I do</p>
  
  <pre><code>cat = Category.objects.get(pk = cat_id)
  data['category_form'] = CategoryForm(instance = cat)
  </code></pre>
  
  <p>and pass the data to my template, which renders the form ok, but the id of the object I about to update is nowhere in the html source. How can the code then now what object to update?</p>
  
  <p>I feel stupid asking this since it should be pretty basic, but I've followed all the tutorials and looked thru the django docs, googled and search this site without luck.</p>
  
  <p>Thanks in advance.</p>