Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
972 B
0
Indexable
Never
from django.http import HttpResponse
from django.shortcuts import render

# Create your views here.
def login(request):
    return render(request,"login.html")
def login_post(request):
    username = request.POST['username']
    password = request.POST['password']
    return HttpResponse('''<script>alert('login successfully');window.location="/myapp/login/"</script>''')
def reg(request):
    return render(request,"reg.html")
def reg_POST(request):
    name=request.POST['name']
    email=request.POST['email']
    phone=request.POST['phone']
    gender=request.POST['gender']
    district=request.POST['DISTRICT']
    password=request.POST['password']
    confirm_password=request.POST['confirm password']
    
    lobj=login()
    lobj.username=email
    lobj.password=confirm_password
    lobj.user_type="user"
    lobj.save()
    return HttpResponse('''<script>alert('login successfully');window.location="/myapp/reg/"</script>''')