title: Reverse for 'task' not found. 'task' is not a valid view function or pattern name
body: <p>in task_list.html {{task.title}} works fine but 'task' in href few lines below doesn't work. It shows the error &quot;NoReverseMatch at /
  Reverse for 'task' not found. 'task' is not a valid view function or pattern name.&quot; for the a tag in 2nd table row in task_list.html</p>
  <p>task_list.html:</p>
  <pre><code> &lt;h1&gt;My To Do List&lt;/h1&gt;
  
  &lt;table&gt;
      &lt;tr&gt;
          &lt;th&gt;Item&lt;/th&gt;
          &lt;th&gt;&lt;/th&gt;
      &lt;/tr&gt;
      {% for task in tasks %}
      &lt;tr&gt;
          &lt;td&gt;{{task.title}}&lt;/td&gt;
          &lt;td&gt;&lt;a href=&quot;{% url 'task' task.title %}&quot;&gt;View&lt;/a&gt;&lt;/td&gt;
      &lt;/tr&gt;
      {% empty %}
          &lt;h3&gt; No items in list&lt;/h3 &gt;
  
      {% endfor %}
  &lt;/table&gt;
  </code></pre>
  <p>urls.py:</p>
  <pre><code>from django.urls import path
  from .views import TaskList, TaskDetail
  
  urlpatterns = [
      path('', TaskList.as_view(), name='tasks'),
      path('task/&lt;int:pk&gt;', TaskDetail.as_view(), name='tasks'),
  ]
  </code></pre>
  <p>views.py:</p>
  <pre><code>from django.shortcuts import render
  from django.views.generic.list import ListView
  from django.views.generic.detail import DetailView
  from .models import Task
  
  class TaskList(ListView):
      model = Task
      context_object_name = 'tasks'
  
  
  class TaskDetail(DetailView):
      model = Task
      context_object_name = 'task'
      template_name = 'base/task.html'
  </code></pre>