当我使用 Django Jinjna 模板将“schemaname.tablename”发送到 id 字段时,引导模式弹出中断
Posted
技术标签:
【中文标题】当我使用 Django Jinjna 模板将“schemaname.tablename”发送到 id 字段时,引导模式弹出中断【英文标题】:Bootstrap modal pop up breaks when i send "schemaname.tablename" into id field using Django Jinjna template 【发布时间】:2021-03-03 23:07:40 【问题描述】:下面是我的 html 脚本,当我将 schema_name.table_name 发送到我的模态的 'id' 属性并且不显示弹出模态并且弹出模态中断,但如以下注释中所述工作良好
注意:当我只将 table_name 发送到 'id' 属性时,会显示弹出窗口,但我还需要发送 schema_name 请帮助
<input type="checkbox" id='dbo.segment_customer_hash_mapping_history' name="acs[]" value="dbo.segment_customer_hash_mapping_history"> dbo.segment_customer_hash_mapping_history
<!-- <form action="/dwdatacatlog2/" method="GET">-->
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModaldbo.segment_customer_hash_mapping_history">Add
filter
<svg viewBox="0 0 16 16" class="bi bi-plus-circle" fill="currentColor"
xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd"
d="M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
<path fill-rule="evenodd"
d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"/>
</svg>
</button>
<!-- <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Small Modal</button>-->
<!-- Modal -->
<div class="modal fade" id="myModaldbo.segment_customer_hash_mapping_history" role="dialog">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<h4>Add Filters</h4>
<!-- <h4 class="modal-title">Modal Header</h4>-->
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<p><small>Table name</small></p>
<p>dbo.segment_customer_hash_mapping_history</p>
<p>
<select id="columnname" name="columnname" class="form-control"
onchange="changecat(this);">
<!-- onchange="populatefilter()"-->
<option value="int////audit_id"> audit_id<small>(int)</small></option>
<option value="int////segment_id"> segment_id<small>(int)</small></option>
<option value="varchar////segment_name"> segment_name<small>(varchar)</small></option>
<option value="varchar////customer_hash"> customer_hash<small>(varchar)</small></option>
<option value="varchar////created_by"> created_by<small>(varchar)</small></option>
<option value="datetime////created_on"> created_on<small>(datetime)</small></option>
</select>
<br>
</select>
<select name="datatype" id="datatype" class="form-control">
<option value="" disabled selected>Select</option>
</select>
<br>
<input type="text" name="parametervalue" class="form-control" aria-label="Default"
aria-describedby="inputGroup-sizing-default"
placeholder="enter corresponding column value" required="True">
</option>
</div>
<div class="modal-footer justify-content-between">
<button type="button" class="btn default" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-secondary "> Submit</button>
</div>
</div>
</div>
</div>
<!-- </form>-->
</tr>
<!-- -->
<tr>
<br>
<!-- <input type="button" value="filter"> -->
<hr>
</tr>
【问题讨论】:
【参考方案1】:属性 id='dbo.segment_customer_hash_mapping_history' '.'导致模式弹出问题
进行了后端更改,以便 id 不会点 '.'这个解决方法可以帮助我
【讨论】:
以上是关于当我使用 Django Jinjna 模板将“schemaname.tablename”发送到 id 字段时,引导模式弹出中断的主要内容,如果未能解决你的问题,请参考以下文章
Django,如何将变量从 Django 管理员传递到模板?