title: Passing data form datatable to modal django
body: <p>I want to display data from datatable to modal bootstrap. </p>
  
  <p>Example:</p>
  
  <pre><code>Name    | prenom | id |edit
  example | test   |  2 |button edit 
  </code></pre>
  
  <p>Button will send data to modal to display for update.</p>
  
  <p>Button code: </p>
  
  <pre><code>&lt;a class="btn btn-info" role="button" data-toggle="modal" data-form="{% url 'up' id=val.id }" data-target="#myEdit" &gt;Edit&lt;/a&gt;
  </code></pre>
  
  <p>Modal code: </p>
  
  <pre><code>&lt;div class="modal fade" id="myEdit" role="dialog"&gt;
      &lt;div class="modal-dialog"&gt;
          &lt;form  class="well contact-form" method="post" action="{% url 
        'up'}"&gt;
              {% csrf_token %}
              &lt;div class="modal-content"&gt;
                  &lt;div class="modal-header"&gt;
                      &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
                      &lt;h4 class="modal-title"&gt;Modal Header&lt;/h4&gt;
                  &lt;/div&gt;
                  &lt;div class="modal-body"&gt;
                      &lt;label for="usr"&gt;Name:&lt;/label&gt;
                      &lt;input type="text" class="form-control" required="" name="uss" value="{{ instance.name }}" id="uss"&gt;
                      &lt;label for="pwd"&gt;Password:&lt;/label&gt;
                      &lt;input  type="password"  class="form-control" required="" value="{{ instance.sname }}" name="pwd" id="pwd" &gt;
                  &lt;/div&gt;
                  &lt;div class="modal-footer"&gt;
                      &lt;button  type="submit" class="btn btn-default"&gt;Valider&lt;/button&gt;
                      &lt;button  value="" type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>views.py </p>
  
  <pre><code>def posts_edit(request, id=None):
      instance = get_object_or_404(namemodel, id=id)
      context={
          'instance': instance
      }
      return render(request, '/ges/sortie/', context)
  </code></pre>
  
  <p>I want to display two values <code>Name</code> and <code>prenom</code> in modal, the data show it from database.</p>
  
  <p>I think the best solution is using ajax.</p>