title: Test Django admin form
body: <p>I'd like to test adding a custom document file form in my application in the admin panel. Unfortunately django documentation is quite obscure about this one.</p>
  
  <p>This is my model:</p>
  
  <pre><code>class Document(models.Model):
      pub_date = models.DateTimeField('date published')
      title = models.CharField(max_length=255)
      description = models.TextField()
      pdf_doc = models.FileField(upload_to=repo_dir, max_length=255)
  </code></pre>
  
  <p>This is my test:</p>
  
  <pre><code>from django.test import TestCase
  from django.test import Client
  from django.utils import timezone
  from datetime import datetime, timedelta
  
  class DocumentAdminFormTest(TestCase):
  
      def test_add_document_form(self):
          client = Client()
          change_url = 'admin/docrepo/document/add/'
          today = datetime.today()
          filepath = u'/filepath/to/some/pdf/'
          data = {'title': 'TEST TITLE',
                  'description': 'TEST DESCRIPTION', 
                  'pub_date0': '2000-01-01',
                  'pub_date1': '00:00:00',
                  'pdf_doc': filepath,
                  }
          response = client.post(change_url, data)
          print('REASON PHRASE: ' + response.reason_phrase)
          self.assertIs(response.status_code, 200)
  </code></pre>
  
  <p>I'd like to get 200 response while posting the form with shown data. For some reason response.status_code gives 404 and response.reason_phrase gives 'Not Found'. Is it possible the problem lies in the directory?</p>