title: Django - unable to modify a record
body: <p>Hy. I want to modify a record for my database.
  I have:</p>
  
  <p>models.py</p>
  
  <pre><code>class People(models.Model):
  first_name = models.CharField(max_length = 50)
  last_name = models.CharField(max_length = 50)
  email = models.EmailField(blank = True)
  grade = models.CharField(max_length = 2)
  
  def __unicode__(self):
      return '%s %s' % (self.first_name, self.last_name)
  
  class PeopleForm(ModelForm):
  class Meta:
      model = People 
  
      fields = ['first_name', 'last_name', 'email', 'grade']
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>def modify(request, person_pk):
  title = 'Creating new program'
  template = 'modify.html'
  
  data = People.objects.get(pk = person_pk)
  
  form = PeopleForm(instance=data)
  context = {'form': form}
  if request.POST:
      form = PeopleForm(request.POST)
      if form.is_valid():
          form.save()
          return HttpResponseRedirect(reverse('/peoples/'))
      else:
          return render_to_response(template, context, context_instance=RequestContext(request))
  return render_to_response(template, context, context_instance=RequestContext(request))
  </code></pre>
  
  <p>urls.py</p>
  
  <pre><code>url(r'^modify/(?P&lt;person_pk&gt;.*)$', views.modify, name='modify'),
  </code></pre>
  
  <p>forms.py </p>
  
  <pre><code>class PeopleForm(forms.ModelForm):
  
  class Meta:
      model = People 
      fields = ('first_name', 'last_name', 'email', 'grade')
  </code></pre>
  
  <p>And template</p>
  
  <pre><code>&lt;form action="/peoples/" method="post"&gt;{% csrf_token %}
  &lt;ul&gt;
  {{form.as_ul}}
  &lt;/ul&gt;
  &lt;input type="submit" name="submit" value="Modify"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I don't know why when I click the modify button, I complete the fields and when I press the button to the previous page, the entry field from database doesn't update. Do you have any suggestions?</p>