title: Reverse for 'post_detail' with arguments '('',)' and keyword arguments '{}' not found. 1 pattern(s) tried: ['posts/(?P[0-9]+)/$']
body: <p>I have this error : </p>
  
  <blockquote>
    <p>Reverse for 'post_detail' with arguments '('',)' and keyword arguments
    '{}' not found. 1 pattern(s) tried: ['posts/(?P[0-9]+)/$']</p>
  </blockquote>
  
  <p>from the line 7 in <code>home.html</code> template : </p>
  
  <pre><code>&lt;a href="{% url 'post_detail' post.id %}"&gt;{{ post.title }}&lt;/a&gt;
  </code></pre>
  
  <h3>From home.html</h3>
  
  <pre><code>&lt;h1&gt;Welcome to Jeremie's blog&lt;/h1&gt;
  
  &lt;h2&gt;Latest Posts&lt;/h2&gt;
  
  {% for posts in posts.all %}
  
  &lt;a href="{% url 'post_detail' post.id %}"&gt;{{ post.title }}&lt;/a&gt;
  &lt;br /&gt;
  {{ posts.pub_date_pretty }}
  &lt;br /&gt;
  &lt;img src = "{{ post.image.url }}" /&gt;
  &lt;br /&gt;
  {{ posts.summary }}
  &lt;br /&gt;
  &lt;br /&gt;
  
  {% endfor %}
  </code></pre>
  
  <h3>From posts_details.html</h3>
  
  <pre><code>{{ post.title }}
  &lt;br /&gt;
  {{ posts.pub_date_pretty}}
  &lt;br /&gt;
  &lt;img src = "{{ post.image.url }}" /&gt;
  &lt;br /&gt;
  {{posts.summary}}
  &lt;br /&gt;
  &lt;br /&gt;
  </code></pre>
  
  <h3>From urls.py</h3>
  
  <pre><code>urlpatterns = [
      url(r'^admin/', admin.site.urls),
      url(r'^$', views.home),
      url(r'^posts/(?P&lt;post_id&gt;[0-9]+)/$', views.post_details, name="post_detail"),
  
  ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
  </code></pre>
  
  <h3>From views.py</h3>
  
  <pre><code>def home(request):
      posts = Post.objects.order_by('pub_date')
      return render(request, 'posts/home.html', {'posts':posts})
  
  def post_details(request, post_id):
      post = get_object_or_404(Post, pk=post_id)
      return render(request, 'posts/posts_detail.html', {'post':post})
  </code></pre>
  
  <h3>From models.py</h3>
  
  <pre><code>class Post(models.Model):
      title = models.CharField(max_length=255)
      pub_date = models.DateTimeField()
      image = models.ImageField(upload_to='media')
      body = models.TextField()
  
      def __str__(self):
          return self.title
  
      def pub_date_pretty(self):
          return self.pub_date.strftime('%b %e %Y')
  
      def summary(self):
          return self.body[:100]
  </code></pre>
  
  <p>It seems that <code>post.id</code> isn't available in the template. However, it is well defined in <code>views.py</code>.</p>
  
  <p>Could anyone be able to tell me how could I fix this problem?</p>