看问题
html代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>添加页面</title> </head> <body> <h1>添加页面</h1> <form action="" method="POST"> {% csrf_token %} {{ form.as_p }} <input type="submit" value="提交"> </form> </body> </html>
解决问题:
在form标签中添加:novalidate
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>添加页面</title> </head> <body> <h1>添加页面</h1> <form action="" method="POST" novalidate> {% csrf_token %} {{ form.as_p }} <input type="submit" value="提交"> </form> </body> </html>