Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.7 kB
1
Indexable
Never
#post method
from django.http import HttpResponse
from django.shortcuts import render
# Create your views here.
from Myapp.models import *
def model(request):
    return HttpResponse("databsetable")
def submit(request):
    return render(request,"hello.html")
def login_post(request):
    username=request.POST['username']
    print(username)
    password=request.POST['password']
    print(password)
    lobj=login()
    lobj.username=username       #use the above name given in the single quotes
    lobj.password=password
    lobj.save()
    return render(request,"output.html",{'username':username,'password':password})
def view(request):
    result=login.objects.all()
    return render(request,"output.html",{'data':result})
def registration(request):
    return render(request,"regform.html")
def registration_post(request):
    Name = request.POST["Name"]
    print(Name)
    Gender = request.POST['Gender']
    print(Gender)
    Place = request.POST['Place']
    print(Place)
    Email = request.POST['emailid']
    print(Email)
    Phone= request.POST['phone']
    print(Phone)
    District= request.POST['address']
    print(District)
    Password= request.POST['password']
    print(Password)
    Submit= request.POST['submit']
    print(Submit)
    Confirm= request.POST['confirm']
    print(Confirm)
    robj=reg()
    robj.Name=Name
    robj.Gender=Gender
    robj.Place=Place
    robj.Email_Id=Email
    robj.Phone_No=Phone
    robj.District=District
    robj.Password=Password
    robj.Submit=submit
    robj.Confirm_Password =Confirm
    robj.save()
    return HttpResponse("Success")