如何在django的数据目标中添加动态变量

时间:2018-05-22 05:48:38

标签: django bootstrap-modal

{% for key,value in config.items %}
     <button type="button" class="btn btn-info btn-xs" data-toggle="modal" data-target='#'{{key}}><i class="fa fa-pencil-square-o" aria-hidden="true"></i></button>
 <div class="modal fade" id={{ key}} role="dialog">
    <div class="modal-dialog">

      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">{{key}}</h4>
        </div>
        <div class="modal-body">
          <p>Some text in the modal.</p>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
      </div>

    </div>
  </div>    
{% endfor %}

//我想通过{{key}}调用每个元素,以便我可以根据循环值显示所有值。有人建议我如何解决这个问题

0 个答案:

没有答案