[英]Django: How to open a small window on button click without changing url
I am using Django and I want to open a small forms window when I click on button 'Nouvelle Chirurgie' in template without changing the url and I don't know if I have to do it with js or no and how to do it, and after that how to save it in views.我正在使用 Django,当我单击模板中的“Nouvelle Chirurgie”按钮而不更改 url 时,我想打开一个小表单窗口,我不知道是否必须使用 js 来执行此操作以及如何执行此操作,以及之后如何将其保存在视图中。 Actually, I'm this button take me to another page:
其实,我是这个按钮把我带到另一个页面:
<a href="{% url 'register_visit' patients.id %}" class="btn btn-primary">Nouvelle Chirurgie</a>
So, what should I do?所以我该怎么做?
You can use bootstrap for this您可以为此使用引导程序
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter">
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
{{ form }}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.