The view TrailDB.views.basic didn't return an HttpResponse object. It returned None instead.

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…

When you’re posting code here, enclose the code between lines of three backtick - ` characters. That means you’ll have a line of ```, then your code, then another line of ```. That forces the forum software to keep your code properly formatted, which is critical with Python.
In this case, you don’t need to repost your code. You can edit your original post to put ``` on the line before your code and another line of ``` after it.
Otherwise, we can’t tell if your code is properly indented.