DEV Community

Discussion on: ValueError Occurring During Saving the Form

Collapse
 
shailesh6363 profile image
Shailesh Waghole

Hello Pavel,
Following is my views.py:

from django.shortcuts import render
from home.models import Contact

Create your views here.

def index(request):

return render(request,'index.html')

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

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

def contact(request):
if request.method =="POST":
name=request.POST.get('name')
phone=request.POST.get('phone')
email=request.POST.get('email')
desc=request.POST.get('desc')
obj1=Contact(name,phone,email,desc)
obj1.save()

return render(request,'contact.html')

def str(self):
self.name