title: Django - ValueError: invalid literal for int() with base 10: 'Confirm email'
body: <p>I keep getting this error and for the life of me I can't find the source of the problem.</p>
  
  <p>Traceback:</p>
  
  <pre><code>/Library/Python/2.7/site-packages/django/core/handlers/base.py in get_response
                      response = middleware_method(request)
  
  /Library/Python/2.7/site-packages/django/middleware/common.py in process_request
                  if (not urlresolvers.is_valid_path(request.path_info, urlconf) and
  
  /Library/Python/2.7/site-packages/django/core/urlresolvers.py in is_valid_path
              resolve(path, urlconf)
  
  /Library/Python/2.7/site-packages/django/core/urlresolvers.py in resolve
          return get_resolver(urlconf).resolve(path)
  
  /Library/Python/2.7/site-packages/django/core/urlresolvers.py in resolve
                  for pattern in self.url_patterns:
  
  /Library/Python/2.7/site-packages/django/core/urlresolvers.py in url_patterns
              patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  
  /Library/Python/2.7/site-packages/django/core/urlresolvers.py in urlconf_module
                  self._urlconf_module = import_module(self.urlconf_name)
  
  /Library/Python/2.7/site-packages/django/utils/importlib.py in import_module
              __import__(name)
  
  /Users/user/Desktop/user/urls.py in &lt;module&gt;
      import contacts.views
  
  /Users/user/Desktop/contacts/views.py in &lt;module&gt;
      import forms
  
  /User/Desktop/contacts/forms.py in &lt;module&gt;
      class ContactForm(forms.ModelForm):
  
  /Users/Desktop/contacts/forms.py in ContactForm
              required=True,
  </code></pre>
  
  <p>I'm following along the effective django tutorials and at this <a href="http://effectivedjango.com/tutorial/forms.html" rel="nofollow">page</a>, but i can't get past the email validation section. I'm not exactly sure what I am doing wrong here.</p>
  
  <p>Forms.py:</p>
  
  <pre><code>from django import forms
  from django.core.exceptions import ValidationError
  
  from contacts.models import Contact
  
  class ContactForm(forms.ModelForm):
  
      confirm_email = forms.EmailField(
          "Confirm email",
          required=True,
      )
  
      class Meta:
          model = Contact
  
      def __init__(self, *args, **kwargs):# Constructor mutates kwarg.
  
          if kwargs.get('instance'):
              email = kwargs['instance'].email# Instance is the name of what's being edited
              kwargs.setdefault('initial', {})['confirm_email'] = email
  
          return super(ContactForm, self).__init__(*args, **kwargs)
  
      def clean(self):
          if (self.cleaned_data.get('email') !=
              self.cleaned_data.get('confirm_email')):
  
                  raise ValidationError(
                      "Email address must match."
                  )
  
          return self.cleaned_data
  </code></pre>
  
  <p>Models:</p>
  
  <pre><code>first_name = models.CharField(max_length=255)
  last_name = models.CharField(max_length=255)
  email = models.EmailField()
  
  def __str__(self):
      return ' '.join([
      self.first_name,
      self.last_name,
      ])
  
  def get_absolute_url(self):
      return reverse('contacts-view', kwargs={'pk': self.id})#Returns address of a contact.
  </code></pre>