title: using get or post to pass argument to django view
body: <p>In my django app ,I need to call a view with an argument named 'year'. Then in the template,I created a form and a dropdown list using a list of year names,At this point,I am confused as to how the view should be invoked.  </p>
  
  <p>The view is named 'create_report_for_data_of_the_year'.It expects a year argument.
  ie,</p>
  
  <pre><code>http://127.0.0.1:8000/myapp/reports/2011
  </code></pre>
  
  <p>I tried to write the template as shown below.</p>
  
  <pre><code>&lt;li id="yearlydataplots" class="report"&gt;
      &lt;form action="create_report_for_data_of_the_year" &gt;
          &lt;select name="year" id="year"&gt;
              {% for anyear in years %}
                  &lt;option  value={{anyear}} &gt; {{anyear}}&lt;/option&gt;
              {% endfor %}
          &lt;/select&gt;
  
          &lt;input type="submit" value="Plot for entries of the year"/&gt;
         &lt;/form&gt;
      &lt;/li&gt;
  </code></pre>
  
  <p>However,when the submit button is clicked,the browser goes to</p>
  
  <pre><code>http://127.0.0.1:8000/myapp/reports/create_report_for_data_of_the_year?year=2006
  </code></pre>
  
  <p>which causes a 404.</p>
  
  <p>I changed method="post", and clicking submit goes to</p>
  
  <pre><code>http://127.0.0.1:8000/myapp/reports/create_report_for_data_of_the_year
  </code></pre>
  
  <p>which again causes 404</p>
  
  <p>I know,I am missing something very basic :-)..If someone can kindly point it out,it would be nice</p>
  
  <p>thanks in advance,</p>
  
  <p>mark</p>
  
  <pre><code>def create_report_for_data_of_the_year(request,year,page_title,template_name):
      dataset=MyDataModel.objects.filter(today__year=year,creator=request.user)
      #today is a field in MyDataModel and is a datetime.datetime 
      map = create_map_of_names_and_values(dataset)
      basefilename = "plotofdataforyear%s"%year
      page_title = page_title+" "+year
      imgfilename= create_plot(map,basefilename)
      report_data={'basefilename':basefilename,'plot_image':imgfilename,'year':year,'page_title':page_title}
      report_data["name_value_dict"]=map
      req_context=RequestContext(request,context)
      return render_to_response(template_name,req_context)
  </code></pre>
  
  <p>and url mapping is</p>
  
  <pre><code>...
  url(r'^reports/(?P&lt;year&gt;\d{4})/$','myapp.views.create_report_for_data_of_the_year',
      {
          'template_name':'myapp/report_for_data_of_the_year.html',
          'page_title':'report for data in the Year'
  
      },name='report_data_for_year' ),
  ...
  </code></pre>