title: Django calling methods of DetailView and RedirectView in template
body: <p>I'm trying to get into Django and got stuck with <code>DeatailView</code> and <code>RedirectView</code> </p>
  
  <p>I made the following template for rendering posts with enabling post detailed view and like button. When I click on either <code>Like</code> or <code>Detail</code> button none of the requests is sent. I tried changing different methods, but that didn't help either. I trying to get whether I was mistaken in the template or in view logic.</p>
  
  <pre><code>{% extends 'base.html' %}
  {% block content %}
      {% for post in object_list %}
      &lt;div class="card" style="width: 40rem;"&gt;
          &lt;img src = "{{ post.image.url }}" style="height: 40rem;"&gt;
          &lt;div class="card-body"&gt;
              &lt;h5 class="card-tittle"&gt;{{post.author.username}}&lt;/h5&gt;
              &lt;p class="card-text"&gt;{{ post.description }}&lt;/p&gt;
              &lt;p class="card-text"&gt;Likes : {{ post.likes.count }}&lt;/p&gt;
              &lt;p class="id"&gt;Post_id: {{ post.id }}&lt;/p&gt;
              &lt;div class="btn-group-vertical"&gt;
                  {% if user.is_authenticated %}
                      &lt;form action="{% url 'like_post' %}" method="POST"&gt;
                          {% csrf_token %}
                          &lt;button type="button" class="btn btn-secondary"&gt;Like&lt;/button&gt;
                      &lt;/form&gt;
                  {% endif %}
                  &lt;form action="{% url 'detail' pk=post.id %}" method="GET"&gt;
                      &lt;button type="button" class="btn btn-secondary"&gt;Detail&lt;/button&gt;
                  &lt;/form&gt;
                  &lt;!-- &lt;button type="button" class="btn btn-secondary"&gt;down&lt;/button&gt; --&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      {% endfor %}
  {% endblock %}
  </code></pre>
  
  <p>Posts <code>views.py</code> file</p>
  
  <pre><code>class PostDetail(DetailView):
      model = Post
  
      def get_context_data(self, *args, **kwargs):
          context = super().get_context_data(*args, **kwargs)
          print(context.items())
          return context
  
  class PostLikeUpvote(RedirectView):
  
      def get_redirect_url(self, *args, **kwargs):
          post_id = kwargs.get('id')
          post = get_object_or_404(Post, id=post_id)
          user = self.request.user
          if user.is_authenticated():
              post.likes.add(user)
          url_redirect = post.get_redirect_url()
          return url_redirect
  </code></pre>
  
  <p><code>urls.py</code></p>
  
  <pre><code>urlpatterns = [
      path('admin/', admin.site.urls),
      path('accounts/', include('accounts.urls')),
      path('new/', PostCreate.as_view(), name='new'),
      path('', PostList.as_view(), name='list'),
      path('posts/', PostList.as_view(), name='list'),
      path('like_post/', PostLikeUpvote.as_view(), name='like_post'),
      path('posts/&lt;pk&gt;/', PostDetail.as_view(), name='detail'),
      path('bot/webhook', csrf_exempt(BotView.as_view())),
  ]
  </code></pre>
  
  <p>Any comments are appreciated.</p>