title: Django - Taking value from POST request
body: <p>I have a list of zones, identified by id (integer).
  How can I get the zone that generated the post request?</p>
  
  <p><strong>manual.html</strong></p>
  
  <pre><code>{% if zone_list %}
      &lt;ul&gt;
          {% for z in zone_list %}
              &lt;b&gt;&lt;p&gt;{{z.name}}&lt;/p&gt;&lt;/b&gt;
              &lt;form action="" method="post"&gt;
                  {% csrf_token %}
                  &lt;input type="submit" name="{{z.id}}" value="ON"/&gt;
                  &lt;input type="submit" name="{{z.id}}" value="OFF"/&gt;&lt;br&gt;
                  &lt;br&gt;
                  &lt;label&gt;Tiempo&lt;/label&gt;:
                  &lt;input type="integerfield" name="Tiempo"&gt;
                  &lt;input type="submit" name="{{z.id}}" value="Start"&gt;
              &lt;/form&gt;
          {% endfor %}
      &lt;/ul&gt;
  {% endif %}
  </code></pre>
  
  <p>In the views.py I have to change the 1 for something that dynamically represents the zone</p>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>def manual(request):
      if request.POST.has_key('1'):
          z = Zone.objects.get(id = 1)
          keyword = request.POST.get("1","")
          if keyword == "ON":
              #do something
          if keyword == "OFF":
              #do something
          if keyword == "Start":
              #do something
      zone_list = Zone.objects.all()
      context = {'zone_list':zone_list}
      return render(request, 'irrigation_controller/manual.html', context)
  </code></pre>