标题:在Button Click 转口上调Runtime Error(Append Slash)
Description: I m encountering a runtime error when I click the submit button on my form. The error mentions something about appending a slash. I ve tried to understand it, but I m stuck. Can someone please help me figure out what s causing this error and how to resolve it? I m using python with django for my project.
Additional Information:
- [Provide relevant code snippets if possible]
- [Any error messages received]
<form action="register" method="POST" onsubmit="register">
{% csrf_token %}
<h3>my information</h3>
<h4>Contact us today, and get reply with in 24 hours!</h4>
<style>
fieldset {
border: medium none !important;
text-emphasis-color:black;
margin: 0 0 10px;
min-width: 100%;
padding: 0;
width: 100%;
}
</style>
<fieldset>
<input placeholder="Your name" type="text" tabindex="1" style="background-color:black;" required autofocus>
</fieldset><br>
<fieldset>
<input placeholder="Your Email Address" type="email" tabindex="2" style="background-color:black;" required>
</fieldset><br>
<fieldset>
<input placeholder="Your Phone Number" type="tel" tabindex="3" style="background-color:black;" required>
</fieldset><br>
<fieldset>
<label for="account">Choose a account:</label>
<select name="account" id="name">
<option value="netflix">netflix</option>
<option value="amazone prime">amazone</option>
<option value="disney plus hotstar">hotstar</option>
</select>
<style>
#nname {
padding: 5px;
color: #f7f7f8;
font-size: 12px;
background: black;
appearance: none;
}
</style>
</fieldset><br>
<fieldset>
<textarea placeholder="Type your Message Here...." tabindex="5" style="background-color:black;" required></textarea>
</fieldset><br>
<fieldset>
<button name="submit" type="submit" id="contact-submit" style="background-color:rgb(23, 12, 12);" data-submit="...Sending" value="submit">Submit</button>
</fieldset><br>
</form>
观点。
from django.shortcuts import render,redirect
from django.contrib.auth.models import User
def register(request):
name=request.POST[ name ]
email=request.POST[ email ]
phone_number=request.POST[ phone_number ]
account=request.POST[ account ]
message=request.POST[ message ]
user=User.objects.create_user(name=name)
print("we wil call back you")
return redirect( / )
urls。 y
from django.urls import path
from django.views import View
from .import views
urlpatterns = [
path( ,views.index,name= index ),
path( contact/ , views.contact,name= contact ),
path( ideagained/ ,views.ideagained,name= ideagained ),
path( idea/ ,views.idea,name= idea ),
path( ouridea/ ,views.ouridea,name= ouridea ),
path( aboutpage/ ,views.aboutpage,name= aboutpage ),
path( register/ ,views.register,name= register )
]