MultiValueDictKeyError at /form 'name1'

42 views Asked by At

I am new at django I was designing my own website to store value of form in the database please help I can't able to overcome the error the error is 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')
0

There are 0 answers