current position:Home>[urgent!] Requests in Django Post exception

[urgent!] Requests in Django Post exception

2022-02-03 02:08:53 CSDN Q & A

def insertcomment(request):    try:        co = comments() = request.POST['com']# Get input data = request.POST['name'] preservation         print(    except Exception as e:        print("error:",e)    return redirect("comment")# Redirect to list page 
<input id="name" type="text" name="name" value="{ 
    { request.session.user_name }}" disabled><textarea id="message" name="com" placeholder="Your Message to Us" value="{ 
    { }}" required></textarea>

This is my view function and html Code , Then when I submit the form , My list page doesn't show what I submitted , What is printed out in exception handling is
error: 'name'

I've just started learning django, I don't know what's going on , Can you help me ?

Refer to the answer 1:

Do you use request.method Judge whether the current request method is post request

Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.

Random recommended