-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2df1f20
commit 777be07
Showing
13 changed files
with
184 additions
and
4 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.urls import path | ||
from . import views | ||
|
||
urlpatterns=[ | ||
path('',views.farmer,name='farmer'), | ||
path('farmerlogin',views.farmerlogin,name='farmerlogin') | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,41 @@ | ||
from django.shortcuts import render | ||
|
||
from django.shortcuts import render,redirect | ||
from django.contrib.auth.models import User,auth | ||
from django.contrib import messages | ||
# Create your views here. | ||
|
||
def farmerlogin(request): | ||
if request.method == 'POST': | ||
first_name = request.POST['first_name'] | ||
# aadhar = request.POST['aadhar'] | ||
password=request.POST['password1'] | ||
|
||
user = auth.authenticate(first_name=first_name,password=password) | ||
|
||
if user is not None: | ||
auth.login(request, user) | ||
return redirect('/') | ||
|
||
else: | ||
messages.info(request, 'Enter the correct password') | ||
return redirect('farmerlogin') | ||
else: | ||
return render(request,'farmerlogin.html') | ||
def farmer(request): | ||
if request.method=='POST': | ||
first_name=request.POST['first_name'] | ||
last_name=request.POST['last_name'] | ||
aadhar=request.POST['aadhar'] | ||
password1=request.POST['password1'] | ||
password2=request.POST['password2'] | ||
|
||
if password1==password2: | ||
user=User.objets.create_user(first_name=first_name,last_name=last_name,email=aadhar,password=password1) | ||
user.save() | ||
return redirect('farmerlogin') | ||
|
||
else: | ||
messages.info(request, 'Password not matching') | ||
return redirect('farmer') | ||
return redirect('/') | ||
else: | ||
return render(request,'farmer.html') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<!--Import Google Icon Font--> | ||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> | ||
<!--Import materialize.css--> | ||
|
||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"> | ||
|
||
|
||
<!--Let browser know website is optimized for mobile--> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> | ||
<style> | ||
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300&display=swap'); | ||
|
||
.nav-wrapper{ | ||
background-image: linear-gradient(to right, #434343 0%, black 100%); | ||
} | ||
#btn{ | ||
background-color: #333; | ||
} | ||
form{ | ||
margin-top: 100px; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
|
||
<nav> | ||
<div class="nav-wrapper"> | ||
<a href="/" class="brand-logo center">SELLBUY</a> | ||
<!-- <a href="" class="sidenav-trigger" data-target='mobile-demo'><i class="material-icons right">menu</i></a> | ||
<ul class="right hide-on-med-and-down"> | ||
<li><a href=""></a></li> | ||
</ul> --> | ||
|
||
</div> | ||
</nav> | ||
<div class="container"> | ||
<h3>Create Account</h3> | ||
<form action="farmer" class="col s12"> | ||
{% csrf_token %} | ||
<div class="input-field"> | ||
<input type="text" name="first_name"> | ||
<label for="">First Name</label> | ||
</div> | ||
<div class="input-field"> | ||
<input type="text" name="last_name"> | ||
<label for="">Last Name</label> | ||
</div> | ||
<div class="input-field"> | ||
<input type="text" name="aadhar"> | ||
<label for="">Aadhar Card number</label> | ||
</div> | ||
<div class="input-field"> | ||
<input type="password" name="password1" id=""> | ||
<label for="">Enter password</label> | ||
</div> | ||
<div class="input-field"> | ||
<input type="password" name="password2" id=""> | ||
<label for="">Confirm password1</label> | ||
</div> | ||
<input type="submit" value="Submit" class="btn" id="btn"> | ||
|
||
</form> | ||
</div> | ||
<!--JavaScript at end of body for optimized loading--> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<!--Import Google Icon Font--> | ||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> | ||
<!--Import materialize.css--> | ||
|
||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"> | ||
|
||
|
||
<!--Let browser know website is optimized for mobile--> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> | ||
<style> | ||
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300&display=swap'); | ||
|
||
.nav-wrapper{ | ||
background-image: linear-gradient(to right, #434343 0%, black 100%); | ||
} | ||
#btn{ | ||
background-color: #333; | ||
} | ||
form{ | ||
margin-top: 100px; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
|
||
<nav> | ||
<div class="nav-wrapper"> | ||
<a href="/" class="brand-logo center">SELLBUY</a> | ||
<!-- <a href="" class="sidenav-trigger" data-target='mobile-demo'><i class="material-icons right">menu</i></a> | ||
<ul class="right hide-on-med-and-down"> | ||
<li><a href=""></a></li> | ||
</ul> --> | ||
|
||
</div> | ||
</nav> | ||
<div class="container"> | ||
<h3>Create Account</h3> | ||
<form action="farmerlogin" class="col s12"> | ||
{% csrf_token %} | ||
<div class="input-field"> | ||
<input type="text" name="first_name"> | ||
<label for="">First Name</label> | ||
</div> | ||
|
||
|
||
<div class="input-field"> | ||
<input type="password" name="password1" id=""> | ||
<label for="">Enter password</label> | ||
</div> | ||
|
||
<input type="submit" value="Submit" class="btn" id="btn"> | ||
|
||
</form> | ||
</div> | ||
<!--JavaScript at end of body for optimized loading--> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script> | ||
</body> | ||
</html> |