title: django: implementing search with select dropdown inputs
body: <p>So here is my HTML. the sub category will be populated by options on the basis of the category selected using js.
  home.html:</p>
  
  <pre><code>&lt;form method="GET" action="{% url 'searchapp:search' city category %}"
        class="form-inline row input-group" id="search"&gt;
      &lt;select class="form-control " id="place" style="" name="city" title="City" required&gt;
          &lt;option&gt;Choose a City...&lt;/option&gt;
          &lt;!--&lt;option value="noida"&gt;Noida&lt;/option&gt;--&gt;
          &lt;option value="delhi"&gt;Delhi/NCR&lt;/option&gt;
          &lt;option value="delhi" disabled&gt;Coming Soon...&lt;/option&gt;
      &lt;/select&gt;
  
      {% csrf_token %}
  
      &lt;select class="form-control " id="category" style="" onchange="subcat()"
              title="Category" name="category" required&gt;
          &lt;option value="none"&gt;Choose a category&lt;/option&gt;
          &lt;option value="aprl"&gt;Apparels &amp; Clothing&lt;/option&gt;
          &lt;-- more options --&gt;
      &lt;/select&gt;
  
      &lt;select class="form-control " id="ms" style="" name="subcateg" title="Sub-Category"
              required&gt;
          &lt;option value="none"&gt;Choose a category first.&lt;/option&gt;
          &lt;-- more options --&gt;
      &lt;/select&gt;
      &lt;span class="input-group-btn " id="inputbutton"&gt;
          &lt;button type="submit" class="btn btn-primary" id="butn"&gt;Find Vendors!&lt;/button&gt;
      &lt;/span&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>This is url for the action of the search form..<br>
  searchapp/urls.py</p>
  
  <pre><code>app_name = 'searchapp'
  
  urlpatterns = [
  
      url(r'^(?P&lt;city&gt;[a-z]+)/(?P&lt;category&gt;[a-z]+)$', views.search, name='search'),
      # url(r'^$', views.search, name='search'),
  ]
  </code></pre>
  
  <p>homeapp/urls.py</p>
  
  <pre><code>app_name = 'home'
  
  urlpatterns = [
      url(r'^$', views.index, name='index'),
  ]
  </code></pre>
  
  <p>now here is the view where i want to display the city and category which was selected</p>
  
  <p>searchapp/views.py</p>
  
  <pre><code>def search(request, city, category):
      # return render(request, 'homeapp/index.html')
      return HttpResponse('&lt;h3&gt;search detail for :'+str(city)+str(category)+'&lt;/h3&gt;')
  </code></pre>
  
  <p>homeapp/views.py: </p>
  
  <pre><code># Create your views here.
  def index(request):
      return render(request, 'homeapp/index.html')
  </code></pre>
  
  <p>when I run the local server and go to my homepage the form should be displayed but instead i get this error</p>
  
  <p><a href="http://i.stack.imgur.com/wfZ1P.png" rel="nofollow">Error</a></p>
  
  <p>the error is: </p>
  
  <pre><code>NoReverseMatch at /
  Reverse for 'search' with arguments '('', '')' and keyword arguments '{}' not found. 1 pattern(s) tried: ['search/(?P&lt;city&gt;[a-z]+)/(?P&lt;category&gt;[a-z]+)$']
  Request Method: GET
  Request URL:    http://127.0.0.1:8000/
  Django Version: 1.10a1
  Exception Type: NoReverseMatch
  Exception Value:    
  Reverse for 'search' with arguments '('', '')' and keyword arguments '{}' not found. 1 pattern(s) tried: ['search/(?P&lt;city&gt;[a-z]+)/(?P&lt;category&gt;[a-z]+)$']
  Exception Location: C:\Users\singhsterabhi\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django-1.10a1-py3.5.egg\django\urls\resolvers.py in _reverse_with_prefix, line 374
  Python Executable:  C:\Users\singhsterabhi\AppData\Local\Programs\Python\Python35-32\python.exe
  Python Version: 3.5.1
  Python Path:    
  ['E:\\projects\\web\\user-portal',
   'C:\\Users\\singhsterabhi\\AppData\\Local\\Programs\\Python\\Python35-32\\lib\\site-packages\\django-1.10a1-py3.5.egg',
   'C:\\Users\\singhsterabhi\\AppData\\Local\\Programs\\Python\\Python35-32\\lib\\site-packages\\psycopg2-2.6.1-py3.5-win32.egg',
   'E:\\projects\\web\\user-portal',
   'C:\\Users\\singhsterabhi\\AppData\\Local\\Programs\\Python\\Python35-32\\python35.zip',
   'C:\\Users\\singhsterabhi\\AppData\\Local\\Programs\\Python\\Python35-32\\DLLs',
   'C:\\Users\\singhsterabhi\\AppData\\Local\\Programs\\Python\\Python35-32\\lib',
   'C:\\Users\\singhsterabhi\\AppData\\Local\\Programs\\Python\\Python35-32',
   'C:\\Users\\singhsterabhi\\AppData\\Local\\Programs\\Python\\Python35-32\\lib\\site-packages']
  Server time:    Sat, 25 Jun 2016 05:48:08 +0530
  </code></pre>
  
  <p>please tell me how to fix it?</p>