简体   繁体   English

单击django模板中的输入标签后重定向到另一个html页面

[英]Redirect to the another html page after clicking input tag in django template

I want to redirect the website after edit ( http://127.0.0.1:8000/account/edit/ ) to the dashboard ( http://127.0.0.1:8000/account/dashboard ) in Django template.我想在编辑( http://127.0.0.1:8000/account/edit/ )后将网站重定向到 Django 模板中的仪表板( http://127.0.0.1:8000/account/dashboard )。 I have a file named dashboard.html in the same directory.我在同一目录中有一个名为dashboard.html 的文件。 But it keeps me to the same page ( http://127.0.0.1:8000/account/edit/ .但它让我停留在同一页面( http://127.0.0.1:8000/account/edit/

edit.html编辑.html

 {% extends "base.html" %} {% block title %}Edit your account{% endblock %} {% block content %} <h1>Edit your account</h1> <p>You can edit your account using the following form:</p> <form action="dashboard.html" method="post" enctype="multipart/form-data"> {{ user_form.as_p }} {{ profile_form.as_p }} {% csrf_token %} <p><input type="submit" value="Save change"></p> </form> {% endblock %}

This can be achieved with js (jquery in this example):这可以通过 js 实现(在这个例子中是 jquery):

script.js:脚本.js:

$('#button-id').click(function() {
  window.location = 'the_new_url';
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 重定向到另一个带有脚本标签的 html 页面 - redirect to another html page with script tag 如何使用 Z9E13B69D1D2DA927102ACAAAFZ15 在 HTML 页面中插入 Django 模板标签 + HTML 元素 - How to insert a Django template tag + HTML element in a HTML page with Javascript 检查电子邮件输入验证后,如何使用我的按钮将用户重定向到另一个HTML页面? - How do I redirect the user to another HTML page using my button after checking for email input validation? Django:HTML表单提交给调用函数并重定向到另一个页面 - Django: HTML Form Submit to Call Function and Redirect to another Page 单击一行必须将页面重定向到另一个URL - Clicking on a row must redirect the page to another URL 单击后退按钮重定向到另一个页面 - Redirect to another page on clicking the back button HTML 5模板标记(页面刷新) - HTML 5 template tag (page refresh) 提交表单后如何重定向到另一个HTML页面? - How to redirect to another HTML page after submitting a form? JS功能(Ionic,AngularJS)后重定向到另一个HTML页面-Cordova - Redirect to another html page after JS function (Ionic, AngularJS) - Cordova 登录尝试成功后重定向到另一个 HTML 页面 | 用 JS - Redirect to another HTML page after successfull login attempt | with JS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM