title: Django Test Client Post Request Fails to Redirect
body: <p>My django.test Client returns a response with status code, 200, when I made a post request instead of redirecting with a status code, 302.</p>
  
  <p>I am using Django 2.2.4 with Python 3.7.3.</p>
  
  <p>No login is required (as addressed by <a href="https://stackoverflow.com/questions/18064832/why-does-django-redirect-test-fail">Why does Django Redirect Test Fail?</a>) neither does setting the follow and secure parameters to True (as addressed by <a href="https://stackoverflow.com/questions/48546354/django-test-client-post-command-not-registering-through-301-redirect">Django test client POST command not registering through 301 redirect</a>)</p>
  
  <p>I noticed that the same problem affects my update view. It doesn't redirect when I call the Django Test Client with a put method.
  (I didn't include this code to avoid verbosity).</p>
  
  <p>Finally, I noticed that the page redirect works when I <code>python manage.py runserver</code> and then visit the page to create a new Book instance.</p>
  
  <p>Here's the test:</p>
  
  <pre class="lang-py prettyprint-override"><code>from django.test import TestCase, Client
  from django.urls import reverse
  ...
  
  class TestDashboardViews(TestCase):
      def setUp(self):
          self.client = Client()
          self.book_list_url = reverse("dashboard-home")
          self.book_create_url = reverse("dashboard-upload-book")
          self.another_demo_book_kwargs = {
              "title": "Demo Title",
              "author": "Demo Author",
              "subject": "Another Demo Subject",
              "details": "Another Demo Details",
              "file": "path/to/another/demo/file"
          }
          ...
  
      def test_book_create_view_using_post_method(self):
          response = self.client.post(self.book_create_url, self.another_demo_book_kwargs)
  
          self.assertRedirects(response, self.book_list_url)
          ...
  </code></pre>
  
  <p>Here's the affected view:</p>
  
  <pre class="lang-py prettyprint-override"><code>class BookCreateView(CreateView):
      model = Book
      fields = ['title', 'author', 'subject', 'details', 'file']
      success_url = reverse_lazy("dashboard-home")
  </code></pre>
  
  <p>Here's the model:</p>
  
  <pre class="lang-py prettyprint-override"><code>from django.db import models
  from django.utils.text import slugify
  
  
  class Book(models.Model):
      title = models.CharField(max_length=50)
      slug = models.SlugField()
      author = models.CharField(max_length=100)
      subject = models.CharField(max_length=50)
      details = models.CharField(max_length=255)
  
      def author_title_path(self, filename):
          return "files/{author}/{filename}".format(author=slugify(self.author), filename=filename)
  
      file = models.FileField(upload_to=author_title_path)
  
      def save(self, *args, **kwargs):
          title_by_author = "{title} by {author}".format(title=self.title, author=self.author)
          self.slug = slugify(title_by_author)
          super().save(*args, **kwargs)
  </code></pre>
  
  <p>and here are my urls:</p>
  
  <pre class="lang-py prettyprint-override"><code>from django.urls import path
  from dashboard.views import BookListView, BookCreateView, BookUpdateView, BookDeleteView
  
  urlpatterns = [
      path("", BookListView.as_view(), name="dashboard-home"),
      path("add_book/", BookCreateView.as_view(), name="dashboard-upload-book"),
      path("edit_book/&lt;slug&gt;/", BookUpdateView.as_view(), name="dashboard-edit-book"),
      path("delete_book/&lt;slug&gt;/", BookDeleteView.as_view(), name="dashboard-delete-book")
  ]
  
  </code></pre>
  
  <p>My test fails with this error:</p>
  
  <pre class="lang-py prettyprint-override"><code>...
  AssertionError: 200 != 302 : Response didn't redirect as expected: Response code was 200 (expected 302)
  ...
  </code></pre>
  
  <p>Please, help.</p>