Beispiel #1
0
def student_view(request):
    form = forms.StudentForm()
    if request.method == 'POST':
        form = forms.StudentForm(request.POST)
        if form.is_valid():
            form.save(commit=True)
            print('data inserted in DB successfuly')
    return render(request, 'testapp/register.html', {'form': form})
Beispiel #2
0
def studentform(request):
    form = forms.StudentForm()
    if request.method == "POST":
        form = forms.StudentForm(request.POST)
        if form.is_valid():
            form.save(commit=True)
            print('form data inserted into database')
    return render(request, 'testapp/register.html', {"form": form})
def studentview(request):
    sf = forms.StudentForm()
    if request.method == 'POST':
        sf = forms.StudentForm(request.POST)
        if sf.is_valid():
            sf.save(commit=True)
            print("Data Insterted Successfully")
    return render(request, 'testapp/stureg.html', {'sf': sf})
Beispiel #4
0
def Student_View(request):
    form = forms.StudentForm()
    if request.method == 'POST':
        form = forms.StudentForm(request.POST)
        if form.is_valid():
            form.save(commit=True)
            print("Form is working fine and data is saved in the DB")
            return render(request, 'testapp/register.html', {'form': form})
    return render(request, 'testapp/register.html', {'form': form})
Beispiel #5
0
def Studentinputview(request):
    form=forms.StudentForm()
    if request.method=='POST':
        form=forms.StudentForm(request.POST)
        if form.is_valid():
            print(' Form validation success and printing data')
            print("Name : ",form.cleaned_data['name'])
            print("Marks : ",form.cleaned_data['marks'])
    return render(request,'input.html',{'form':form})
def index_view(request):
    form = forms.StudentForm()
    if request.method == 'POST':
        form = forms.StudentForm(request.POST)
        if form.is_valid():
            print("studentname", form.cleaned_data['name'])
            print("marks", form.cleaned_data['marks'])
            form.save(commit=True)
            # print("rollno",form.cleaned_data['rollno'])
            # print("email",form.cleaned_data['email'])
            return you_view(request)

    return render(request, 'test/index.html', {'form': form})
Beispiel #7
0
def student_view(request):
    form = forms.StudentForm
    if request.method == 'POST':
        form = forms.StudentForm(request.POST)
        if form.is_valid:
            form.save(commit=True)
            print('DATA INSERTED SUCCESSFULLY !!!!')
    return render(request, 'testapp/res1.html', {'form': form})