【问题标题】:Bootstrap form in modal cannot resolve file模式中的引导表单无法解析文件
【发布时间】:2018-02-10 19:07:28
【问题描述】:

我想将我的 deleteview URL 链接到我的模式上的“是”按钮,但是,它没有删除,并且在 pycharm 中,它显示为:“无法解析文件”。我检查了我的网址和视图,它们似乎都是正确的。任何帮助深表感谢。注意:我是引导新手

{% for patient in all_patients %}
<!-- Delete Patient -->
<input type="hidden" name="patient_id" value="{{ patient.id }}" />
<button type="submit" class="btn btn-default btn-sm" data-toggle="modal" data-target="#{{patient.id}}">
    <span class="glyphicon glyphicon-trash"></span>
</button>

<!-- Modal -->
<div class="modal fade" id="{{patient.id}}" 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">Confirm delete</h4>
            </div>
            <div class="modal-body">
                <p>Are you sure you want to delete {{ patient }}?</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">No</button>
                <form action="{% url 'patients:patient-delete' patient.id %}" method="post" style="display: inline;">
                    {% csrf_token %}
                    <button type="button" class="btn btn-danger" data-dismiss="modal">Yes</button>
                </form>
            </div>
        </div>

    </div>
</div>

【问题讨论】:

  • 你能发布错误日志吗
  • 没有错误,只是没有删除

标签: jquery python html django twitter-bootstrap


【解决方案1】:

在按钮输入type="submit"

【讨论】:

  • 感谢您的建议,但没有任何区别:(
  • 那么你的操作网址有问题,而不是引导程序
  • 尝试使用绝对网址,而不是相对网址,看看它是否有效。
  • 再一次,没有效果。 url 的每个部分都带有“无法解析目录”。
猜你喜欢
  • 2021-11-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-13
  • 1970-01-01
  • 1970-01-01
  • 2012-05-20
  • 1970-01-01
相关资源
最近更新 更多