0

我是 django 的新手,我正在设计自己的网站以将表单的值存储在数据库中,请帮助我无法克服错误,错误是 multivaluedicterror

from django.shortcuts import render
from django.http import HttpResponse
from main.models import recieve_content

# Create your views here.
def index(request):
    return render(request,'index.html')

def about(request):
    return render(request,'about.html')

def contact(request):
    return render(request,'contact.html')

def donation(request):
    return render(request,'donation.html')

def form(request):
    if request.method=="POST":
        name1=request.POST["name1"]
        name2=request.POST["name2"]
        address=request.POST["address"]
        content=request.POST["content"]
        data=recieve_content(fname=name1,lname=name2,address=address,content=content)
        data.save()
        return HttpResponse("your data saved successfully")
    return render(request,'form.html')
4

0 回答 0