title: Dynamic URL routing not working in Django
body: <p>Here is my urls.py of app 'api' of project 'REST Api':</p>
  <pre><code>from django.conf.urls import url
  from . import views
  app_name = 'api'
  urlpatterns  = [
      url(r'^view/&lt;int:test_id&gt;/$' , views.add_task_to_list, name= &quot;add_task&quot;),
      url(r'^$', views.index, name=  &quot;index&quot;)
  ]
  </code></pre>
  <p>and here is my views.py of app 'api':</p>
  <pre><code># -*- coding: utf-8 -*-
  from __future__ import unicode_literals
  from django.shortcuts import render
  from django.http import HttpResponseRedirect, HttpResponse
  from .forms import task_form, list_form
  from .models import List, Task
  
  # Create your views here.
  def index(request):
      l_form = list_form(request.POST or None)
      if l_form.is_valid():
          l_form.save()
          return HttpResponseRedirect('/')
      # tasks = Tasks()
      lists = List.objects.all()
      context = {
          'l_form': l_form,
          'lists': lists
      }
      return render(request, 'api/main.html', context)
  
  
  def add_task_to_list(request, test_id):
      task = Task()
      task.list = List.objects.get(pk=test_id)
      form = task_form(request.POST or None, instance= task)
      if form.is_valid:
          form.save()
      context = {
          'task':task,
          'form':form
      }
      return render(request, &quot;api/create_task.html&quot;, context)
  </code></pre>
  <p>And here is my models.py of app 'api':</p>
  <pre><code># -*- coding: utf-8 -*-
  from __future__ import unicode_literals
  from django.db import models
  
  class List(models.Model):
      date = models.DateField()
      author = models.CharField(
          max_length=100,
          blank= True
      )
      def __str__(self):
          return self.author
  
  class Task(models.Model):
      task_name = models.CharField(
          max_length=150,
      )
      complete_status = models.BooleanField(
          default= False,
          blank= True
      )
      priority = models.IntegerField()
      list = models.ForeignKey(List, on_delete=models.CASCADE)
      def __str__(self):
          return self.task_name
  </code></pre>
  <p>But when I run my server, and then navigate to 'views/5' or any such dynamic url as mentioned in 'urls.py', I get an error saying:</p>
  <pre><code>Page not found (404)
  Request Method: GET
  Request URL:    http://127.0.0.1:8000/view/5
  Using the URLconf defined in REST_Api.urls, Django tried these URL patterns, in this order:
  
  ^admin/
  ^view/&lt;int:test_id&gt;/$ [name='add_task']
  ^$ [name='index']
  The current path, view/5, didn't match any of these. 
  </code></pre>
  <p>Can somebody tell me what is the mistake I am committing here?</p>