【问题标题】:Failing to submit to a link page未能提交到链接页面
【发布时间】:2021-04-22 13:59:15
【问题描述】:

当我点击提交按钮时出现 404 错误,我想提交到“new_search”

{% extends 'base.html' %}

{% block content %}

    <form action="{ % url 'new_search' %}" method="post">
        {% csrf_token %}
        <input type="text" name="search" value="search" placeholder="search">
        <input type="submit" name="submit">
    </form>


{% endblock content %}

页面

【问题讨论】:

  • 按 F12 并在网络选项卡中查找它尝试访问的 URL 并修复它

标签: python html django django-templates


【解决方案1】:

你的代码有错别字,替换:

{ % url 'new_search' %}

{% url 'new_search' %}

【讨论】:

    猜你喜欢
    • 2021-01-03
    • 2016-02-01
    • 2010-12-01
    • 2016-11-20
    • 2021-08-21
    • 1970-01-01
    • 1970-01-01
    • 2023-03-04
    • 2014-01-22
    相关资源
    最近更新 更多