def logins(request): #get method
return render(request,"login.html")
def loginpost(request): #post method
username=request.POST['username']
password=request.post['password']
return HttpResponse('''<script>alert('login success');windows.location="/Myapp/login/"</script>''')
def regist(request): #get method
return render(request,"registration.html")
def registpost(request): #POST METHOD
Name=request.POST['Name']
Gender=request.POST['Gender']
Place = request.POST['Place']
Email_Id = request.POST['emailid']
Phone_NO = request.POST['phone']
Image = request.FILES['image']
District = request.POST['address']
Password=request.POST['password']
Confirm_Password = request.POST['confirm']
#for login
lobj=login()
lobj.username=Email_Id
lobj.password=Confirm_Password
lobj.user_type="user"
lobj.save()
fs = FileSystemStorage()
s = datetime.now().strftime("%y%m%d-%H%M%S") + ".jpg"
fn = fs.save(s, Image)
path = fs.url(s)
# fobj=registration()
# fobj.file=path
# fobj.save()
#for registration
robj=registration() #from modelsname=registration
robj.name=Name
robj.gender=Gender
robj.district=Place
robj.email=Email_Id
robj.phone=Phone_NO
robj.image=path
robj.LOGIN=lobj
robj.save()
return HttpResponse('''<script>alert("registration successfull");window.location="/Myapp/login/"</script>''')