title: Passing variable to html page using Python Django
body: <p>I am creating a site using python and django. I have 2 models, Action and Image: </p>
  
  <pre><code>class Action(models.Model):
      name = models.CharField("Action name", max_length=50)
      keywords = models.CharField("Keywords", max_length=50)
      object = models.CharField("Object", max_length=50, blank=True, null=True)
      uploadDate = models.DateField("Date", default=get_current_date)
      UploadedBy = models.CharField("UploadedBy", max_length=50, default="")
  
  class Image(models.Model):
      image = models.FileField(upload_to=get_upload_file_name, default="") 
      action = models.ForeignKey(Action)
  </code></pre>
  
  <p>I have created a combined form which allows users to create one action and add an image. 
  Now I am trying to make a form which users can upload an image only, relating to an action, following on from the current page they are viewing the action. </p>
  
  <p>Below shows the html template for ActionDetails:  </p>
  
  <pre><code>&lt;ul&gt;
  &lt;li&gt;&lt;h3&gt; Name: &lt;/h3&gt; {{ action.name }} &lt;/li&gt;
  &lt;li&gt;&lt;h3&gt; Keywords: &lt;/h3&gt; {{ action.keywords }} &lt;/li&gt;
  &lt;li&gt;&lt;h3&gt;Uploadedby: &lt;/h3&gt; {{ action.UploadedBy }}&lt;/li&gt;
  {% if action.object %} 
  &lt;li&gt;&lt;h3&gt;Object:&lt;/h3&gt; {{ action.object }}&lt;/li&gt;
  {% endif %}
  &lt;/ul&gt;
  
  &lt;p&gt;&lt;a class="btn btn-default" href="img"&gt;Add Image &amp;raquo;&lt;/a&gt;&lt;/p&gt;
  
  {% if image.image %} 
  &lt;p&gt;&lt;h3&gt;Image:&lt;/h3&gt;&lt;img src= "/static/app/{{image.image}}" width='300'/&gt;&lt;/p&gt;
  {% endif %}
  </code></pre>
  
  <p>I would like that once the form opens (btn 'Add Image') is clicked, the action.id is passed to the ImageForm page.</p>
  
  <p>views.py: </p>
  
  <pre><code>def addimg(request):
      if request.method == "GET":
          form = ImageForm;
          return render(request,'app/createForm.html', { 'form':form })
      elif request.method == "POST":
          form = ImageForm(request.POST, request.FILES)
          if form.is_valid():
              form.save()
              return HttpResponseRedirect('/actions')
          else: 
              form = ImageForm;
              return render(request, 'app/createForm.html', { 'form':form })
  </code></pre>
  
  <p>Is there a way of doing this? </p>