title: how to render a djangoform into bootstrap modal window
body: <p>I am strating to learn Django and I want to display some forms in bootstrap modal view.
  I have a template with a HTML table, this table have a column with a drop down button with several options.
  the table is rendered with django-tables2 and the forms are rendered with django-crispy-forms</p>
  
  <p>My form definition for the modal form:</p>
  
  <pre><code>class RecepcionForm(forms.ModelForm):
      fecha_recepcion = forms.DateField(widget=DateInput())
      def __init__(self,*args,**kwargs):
         super(RecepcionForm,self).__init__(*args,**kwargs)
         self.helper = FormHelper(self)
         self.helper.layout = Layout(
              Field('id_proveedor',
                    'anio',
                    'mes',
                    'usuario',
                    readonly = True
               ),
              Fieldset('',
                       'fecha_recepcion',
                       'num_archivos',
                       Submit('save','Grabar'),
                       HTML('&lt;a class="btn btn-danger" href={% url "monitor" %}&gt;Cancelar&lt;/a&gt;')
              )
         )
      class Meta:
         model = DetalleRecepcion
  </code></pre>
  
  <p>My view for the modal form:</p>
  
  <pre><code>@login_required(login_url='/login/')
  def RecepModalView(request):
      idp = request.GET.get('i')
      anio = request.GET.get('a')
      mes = request.GET.get('m')
      if request.method == 'POST':
         r = DetalleRecepcion.objects.get(id_proveedor=idp,anio=anio,mes=mes)
         form = RecepcionForm(request.POST, instance=r)
         if form.is_valid():
            form.save()
            return HttpResponseRedirect('/monitor/')
      else:
         r = DetalleRecepcion.objects.get(id_proveedor=idp,anio=anio,mes=mes)
         r.usuario = request.user
         form = RecepcionForm(instance=r)
  
      return render_to_response('recepmodal.html',
                                {'form':form},
                                context_instance=RequestContext(request))
  </code></pre>
  
  <p>My template for the modal form</p>
  
  <pre><code>{% load crispy_forms_tags %}
  &lt;div class="modal fade" id="recmodal" tabindex="-1" role="dialog"  aria-labelledby="myModalLabel" aria-hidden="true"&gt;
    &lt;div class="modal-dialog"&gt;
      &lt;div class="modal-content"&gt;
        &lt;div class="modal-header"&gt;
          &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;
          &lt;h4 class="modal-title" id="myModalLabel"&gt;Register &lt;/h4&gt;
        &lt;/div&gt;
        &lt;div class="modal-body"&gt;
          &lt;form action="" method=post"&gt;
           &lt;div class="tab-content"&gt;
             &lt;div class="tab-pane active" id="tab1"&gt;
  
      {% crispy form %}
  
             &lt;/div&gt;
           &lt;/form&gt;
           &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="modal-footer"&gt;
          &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Cancel&lt;/button&gt;
          &lt;button type="button" class="btn btn-primary"&gt;Submit&lt;/button&gt;
  
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I don't know how to open and pass arguments to the modal form.</p>
  
  <p>I try using the django tag include
  Example snippet:</p>
  
  <pre><code>&lt;body&gt;
  &lt;table&gt;
  .
  .
  .
  &lt;/table&gt;
  
  {% include 'recmodal.html' %}
  
  &lt;/body&gt;
  </code></pre>
  
  <p>but I get this error
  <strong>Exception Value: Failed lookup for key [form] in</strong></p>
  
  <p>In simple word how can I pass values and open a bootstrap modal form in django using django-crispy-forms.</p>
  
  <p>Any advice </p>
  
  <p>Thansk in advance</p>