title: Unable to redirect Django form
body: <p>I am trying to build a simple blog with a basic post function through a very simple form. The function I am trying to accomplish is:</p>
  
  <p>if the new post POSTs (no errors etc.) save to the database and redirect to the newly created post_details page. Otherwise I want it to re render the post form again. I keep getting the error NoReverseMatch at /post/pk and I cannot find my error. I am obviously not understanding something properly. The related code is below:</p>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>def post_new(request):
  if request.method == "POST":
      form = PostForm(request.POST)
      if form.is_valid():
          post = form.save(commit=False)
          post.author = request.user
          post.published_date = timezone.now()
          post.save()
          return redirect('post_detail', pk=post.pk)
  else:
      form = PostForm()
  return render(request, 'blog/post_edit.html', {'form': form})
  </code></pre>
  
  <p><strong>post_edit.html</strong></p>
  
  <pre><code>{% extends 'blog/base.html' %}
  
  {% block content %}
      &lt;h2&gt;New post&lt;/h2&gt;
      &lt;form method="POST" class="post-form"&gt;{% csrf_token %}
          {{ form.as_p }}
          &lt;button type="submit" class="save btn btn-default"&gt;Save&lt;/button&gt;
      &lt;/form&gt;
  {% endblock %}
  </code></pre>
  
  <p><strong>urls.py</strong></p>
  
  <pre><code>from django.urls import path 
  from . import views
  
  urlpatterns = [
      path('', views.post_list, name='post_list'),
      path('post/&lt;int:pk&gt;/', views.post_detail, name='post_detail'),
      path('post/new/', views.post_new, name='post_new'),
  ]
  </code></pre>