title: Django: posting a template value to a view
body: <h2>The Problem:</h2>
  <p>I'm tying to post to a view and pass on a value from the template by using a hidden value field and a submit button. The values from the submit button (ie the csrf_token) gets through but the hidden value does not. I've checked from the Wezkrug debugger that <code>request.POST</code> only contains form values and not my <code>'id'</code> value from the hidden field.</p>
  <h3>Background:</h3>
  <p>The button takes you to a form where you can enter a comment. I'm trying to include the <code>review.id</code> that the user is commenting on to make commenting easy. I have the value as 'test' not for test purposes.</p>
  <p>My form:</p>
  <pre><code>&lt;div&gt;
       &lt;form method='POST' action='/add_comment/'&gt;
           {% csrf_token %}
           &lt;input type=&quot;hidden&quot; name='id' value='test'&gt;
           &lt;input type=&quot;submit&quot; value=&quot;Make a Comment&quot;&gt;
       &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  <p>Comment View:</p>
  <pre><code>@login_required
  def make_comment(request):
      if request.method == 'POST':
          
          form = CommentForm(request.POST)
          if form.is_valid():
              comment = form.save(commit=False)
              comment.user = request.user
              comment.save()
              # render?
              return HttpResponseRedirect('/results/', {
                  'restaurant': get_object_or_404(
                                                  Restaurant, 
                                                  name=request.POST['name'], 
                                                  address=request.POST['address']
                                                  )
                  })
      else:
          form = CommentForm()
      return render(request, 'stamped/comment.html', {'form': form})
  </code></pre>
  <p>Comment Model:</p>
  <pre><code>class Comment(models.Model):
      content = models.TextField()
      review = models.ForeignKey(Review)
      user = models.ForeignKey(User)
      date_added = models.DateTimeField(auto_now_add=True)
  </code></pre>
  <p>Comment ModelForm Code:</p>
  <pre><code>class CommentForm(ModelForm):
      class Meta:
          model = Comment
          exclude = ('user', 'review',)
  </code></pre>
  <p>I've been trying to follow the tactics in this question, but using the request.session dict is undesirable because Id have to store an id for every review regardless if they're are ever commented on.</p>
  <p><a href="https://stackoverflow.com/questions/12097475/what-is-a-more-efficient-way-to-pass-variables-from-template-to-view-in-django">What is a more efficient way to pass variables from Template to View in Django?</a></p>
  <p>Any ideas on how to include the hidden value in the POST? Thanks!</p>