Skip to content Skip to sidebar Skip to footer

How To Render Html Form In Django

As I am trying to make use bootstrap file in my django application I am not able to make connections my models I am able to see the bootstrap theme when I run server but when I ent

Solution 1:

if you are using ModelForm for that Model change your view to this

defcontact(request):
    if request.method == 'POST':

        form = details_forms(request.POST)
        if form.is_valid():
           form.save()
           return render(request,'contact.html',{'form':form})
    else:
        form = details_forms()
    return render(request,'contact.html',{'form':form})

change this in your form

classMeta(): model = studentfields= ['name','email','phone','message']

to

classMeta:
      model = studentfields= ['name','email','phone','message']

Post a Comment for "How To Render Html Form In Django"