from django.shortcuts import render
from myform.forms import StudentForm
# Create your views here.
def index(request):
form = StudentForm()
if request.method == 'post':
form = StudentForm(request.post)
if form.is_valid():
form.save()
context = {'form':form}
return render(request, 'myform/index.html', context)
Side note: When posting code here, enclose the code between lines of three backtick - ` characters. This means you’ll have a line of ```, then the code, then another line of ```. This forces the forum software to keep your code properly formatted. (I’ve taken the liberty of modifying your original post for this.)
Python is case sensitive.
See request.POST and the view