title: Test of form containing ImageField resulting in type error
body: <p>I'm trying to test a form that contains an ImageField and I'm getting an error.  I've tried stepping through the Django code but I keep getting lost and I can't see the problem.  I've researched how this is supposed to be done and I thought I was doing everything correctly.</p>
  
  <p>Here's the error which occurs at the assertTrue statement in my test:</p>
  
  <pre><code>TypeError: is_valid() takes exactly 2 arguments (1 given)
  </code></pre>
  
  <p>Here are my files:</p>
  
  <pre><code># forms.py
  class UploadMainPhotoForm(forms.Form):
      photo = forms.ImageField(error_messages={'required': err_msg__did_not_choose_photo})
  
      def is_valid(self, request):
  
          # Run parent validation first
          valid = super(UploadMainPhotoForm, self).is_valid()
          if not valid:
              return valid
  
          if request.FILES:
              photo_file = request.FILES['photo']
              file_name, file_ext = os.path.splitext(photo_file.name)
          else:
              self._errors['photo'] = 'You forgot to select a photo.'
              return False
  
          # Return an error if the photo file has no extension
          if not file_ext:
              self._errors['photo'] = err_msg__photo_file_must_be_jpeg
              return False
  
          return True
  
  # upload_photo.html (template)
  &lt;form method="post" enctype="multipart/form-data" action="."&gt;{% csrf_token %}
      &lt;input type="file" name="photo" /&gt;
      &lt;input type="submit" name="skip_photo" value="Skip Photo" /&gt;
      &lt;input type="submit" name="upload_photo" value="Upload Photo"&gt;
  &lt;/form&gt;
  
  # form_tests.py
  class TestUploadMainPhotoForm(TestCase):
      def initial_test(self):
          post_inputs = {'upload_photo': '[Upload Photo]'}
          test_photo = open('photo.jpg', 'rb')
          file_data = {'file': SimpleUploadedFile(test_photo.name, test_photo.read())}
          self.assertTrue(UploadMainPhotoForm(post_inputs, file_data).is_valid())
  </code></pre>