title: Page not found (404) - No Post matches the given query
body: <p>I'm working on a Django blog, and having implemented slug for post titles I've stumbled upon an issue.<br>
  The error is</p>
  
  <blockquote>
    <p>Page not found (404)<br>
    Request Method: GET<br>
    Request URL:    <a href="http://localhost:8000/post/new/" rel="nofollow">http://localhost:8000/post/new/</a><br>
    Raised by:  blog.views.post_detail<br><br>
    No Post matches the given query.</p>
  </blockquote>
  
  <p>This is my <strong>urls.py</strong></p>
  
  <pre><code>from django.conf.urls import include, url
  from . import views
  from django.conf import settings
  from django.conf.urls.static import static
  
  urlpatterns = [
      url(r'^$', views.post_list),
      url(r'^register', views.register),
      url(r'^activate/(?P&lt;activation_key&gt;\w+)/', views.register_confirm),
      url(r'^email_check', views.email_check),
      url(r'^password_check', views.password_check),
      url(r'^login', views.login),
      url(r'^edit/$', views.update_profile),
      url(r'^post/(?P&lt;slug&gt;[-_\w]+)/$', views.post_detail),
      url(r'^post/new/$', views.post_new, name='post_new'),
      url(r'^post/(?P&lt;slug&gt;[-_\w]+)/edit/$', views.post_edit, name='post_edit'),
      url(r'^drafts/$', views.post_draft_list, name='post_draft_list'),
      url(r'^post/(?P&lt;slug&gt;[-_\w]+)/publish/$', views.post_publish, name='post_publish'),
      url(r'^post/(?P&lt;slug&gt;[-_\w]+)/remove/$', views.post_remove, name='post_remove'),
      url(r'^post/(?P&lt;slug&gt;[-_\w]+)/comment/$', views.add_comment_to_post, name='add_comment_to_post'),
      url(r'^comment/(?P&lt;slug&gt;[-_\w]+)/approve/$', views.comment_approve, name='comment_approve'),
      url(r'^comment/(?P&lt;slug&gt;[-_\w]+)/remove/$', views.comment_remove, name='comment_remove'),
  ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
  </code></pre>
  
  <p>The <strong>view.py</strong> file</p>
  
  <pre><code>@login_required
  def post_new(request):
      if request.method == "POST":
          form = PostForm(request.POST)
          if form.is_valid():
              post = form.save()
              post.author = request.user
              post.published_date = timezone.now()
              post.save()
              return redirect('blog.views.post_detail', slug=post.slug)
      else:
          form = PostForm()
      return render(request, 'blog/post_new.html', {'form': form})
  </code></pre>
  
  <p>It says that the error is raised by "post_detail", so here it is</p>
  
  <pre><code>def post_detail(request, slug):
      post = get_object_or_404(Post, slug=slug)
      return render(request, 'blog/post_detail.html', {'post': post})
  </code></pre>
  
  <p>What am I missing?</p>