gpt4 book ai didi

python - 单选按钮重定向 url 不起作用

转载 作者:行者123 更新时间:2023-12-01 09:16:59 25 4
gpt4 key购买 nike

我有两个注册页面:学生 View 和家长 View 。默认注册网址位于学生页面 http://127.0.0.1:8000/account/student-sign-up/ 。但是,当按下父按钮时,页面会重定向到未知 URL http://127.0.0.1:8000/account/student-sign-up/parent_sign_up.html。 。我想知道如何使按钮重定向到 http://127.0.0.1:8000/account/parent-sign-up ,没有学生注册前缀。

HTML

<!-- Radio check 1 -->
<div class="form-check form-check-inline radio">
<label class="form-check-label">
<input class="form-check-input" type="radio" name="radios" id="radio1" onclick="document.location.href='student_sign_up.html'"
checked /> Individual
</label>
</div>

<!-- Radio check 2 -->
<div class="form-check form-check-inline radio">
<label class="form-check-label">
<input class="form-check-input" type="radio" name="radios" id="radio2" onclick="document.location.href='parent_sign_up.html'"
/> Parent of a child under 13
</label>
</div>

url.py

urlpatterns = [
path('login/', views.login_view, name='login'),
path('student-sign-up/', views.student_sign_up, name='student_sign_up'),
path('parent-sign-up/', views.parent_sign_up, name='parent_sign_up'),
path('teacher-sign-up/', views.teacher_sign_up, name='teacher_sign_up'),
path('reset-password/', views.reset_password, name='reset_password'),
path('reset-password-after/', views.reset_password2, name='reset_password_after'),

最佳答案

按如下方式更改两个输入:

 <input class="form-check-input" type="radio" name="radios" id="radio1" onclick="document.location.href='/account/student-sign-up/'"
checked /> Individual


<input class="form-check-input" type="radio" name="radios" id="radio2" onclick="document.location.href='/account/parent-sign-up/'"
/> Parent of a child under 13

关于python - 单选按钮重定向 url 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51160247/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com