title: Django/Python: Pulling value from template into views.py
body: <p>I currently have a search function in my views.py file like so:</p>
  
  <pre><code>def json_search(request):
      query = request.GET.get('query')
      api_key = locu_api
      url = 'https://api.locu.com/v1_0/venue/search/?api_key=' + api_key
      locality = query.replace(' ', '%20')
      category = 
      final_url = url + "&amp;locality=" + locality + "&amp;category=" + category
      json_obj = urllib2.urlopen(final_url)
      decoded_data = json.load(json_obj)
      return render(request, 'loc_search.html',
                         {'objects': decoded_data['objects']})
  </code></pre>
  
  <p>What I have set up is a drop-down search bar whereby I want the category variable within my json_search() function to automatically be assigned to the selected option on the drop-down bar before the form is submitted using the submit button. The search bar looks like this :</p>
  
  <p><img src="https://i.stack.imgur.com/duz14.jpg" alt="enter image description here"></p>
  
  <p>And the code like this:</p>
  
  <pre><code>&lt;form action="{% url 'search' %}"&gt;
  &lt;div class="input-group"&gt;
          &lt;input name="query" input id="address" type="textbox" placeholder="City or Zipcode" class="form-control datebox"&gt;
          &lt;div class="input-group-btn"&gt;
              &lt;button class="btn btn-default" type="submit" id="addressSearch"&gt;Search&lt;/button&gt;
              &lt;button name = "category_query" tabindex="-3" data-toggle="dropdown" class="btn btn-default dropdown-toggle" type="button"&gt;
                  &lt;span class="caret"&gt;&lt;/span&gt;
                  &lt;span class="sr-only"&gt;Toggle Dropdown&lt;/span&gt;
              &lt;/button&gt;
              &lt;ul class="dropdown-menu" &gt;
                  &lt;li&gt;&lt;a href="restaurants"&gt;Resturant&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="active"&gt;Activities&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="bars"&gt;Bar / Club&lt;/a&gt;&lt;/li&gt;
                  &lt;li class="divider"&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="other"&gt;other&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Is this even possible?</p>