Dear,
I am Learning Python and Django. In my trail project, I created a model form and it works perfectly. then I tried to create next model in the same file and trying to run. it always gives the same error “The view TrailDB.views.basic didn’t return an HttpResponse object. It returned None instead.”
The following is the codes i am using for the particular model.
def basic(request):
if request.method == “POST”:
bas = forms.Basic_Details_Data(request.POST)
if bas.is_valid():
Basic_D = models.Basic_Details(title=request.POST[‘title’],
firstname=request.POST[‘firstname’],
lastname=request.POST[‘lastname’],
dob=request.POST[‘dom’],
age=request.POST[‘age’],
email=request.POST[‘email’],
marital_status=request.POST[‘marital_status’],
gender=request.POST[‘gender’])
Basic_D.save()
return redirect(’/TrailDB/display’)
else:
bas = forms.Basic_Details_Data()
return render(request, ‘display.html’, {‘bas’: bas})
Please advise…