class recruiterLogin(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
mobile = models.CharField(max_length=15,null=True)
image = models.FileField(null=True)
gender = models.CharField(max_length=10)
type = models.CharField(max_length=15)
def __str__(self):
return self.user.username
-----------------------------------------------------------------Views.py
def recruiteRegister(request):
error = ""
if request.method == 'POST':
fname = request.POST['firstname'],
lname = request.POST['lastname'],
email = request.POST['email'],
phone = request.POST['phone'],
Pwd = request.POST['password1'],
gender = request.POST['gender'],
img = request.FILES['images'],
userss = User.objects.create_user(first_name=fname,last_name=lname,username=email,password=Pwd)
recruiterLogin.objects.create(user=userss,mobile=phone,gender=gender,image=img,type="Recruiter")
userss.save()
return redirect("/")
print("success")
else:
return render(request, 'recruiteRegister.html')
-------------------------------------------------------------------------------------
userform
<form role="form" action="recruiteRegister" onsubmit="return checkpass();" name="recregister" method="post" enctype="multipart/form-data">
{% csrf_token %}
<fieldset>
<div class="form-group">
<input class="form-control" placeholder="First Name" name="firstname" type="text" autofocus>
</div>
<div class="form-group">
<input class="form-control" placeholder="Last Name" name="lastname" type="text" autofocus>
</div>
<div class="form-group">
<input class="form-control" placeholder="E-mail" name="email" type="email" autofocus>
</div>
<div class="form-group">
<input class="form-control" placeholder="+91 99999****" name="phone" type="number" value="">
</div>
<div class="form-group">
<input class="form-control" placeholder="Password" name="password1" type="password" value="">
</div>
<div class="form-group">
<input class="form-control" placeholder="Confirm Password" name="password2" type="password" value="">
</div>
<div class="form-group">
<label>Gender: </label>
<div class="form-check">
<input class="form-check-input" type="radio" name="gender" >
<label class="form-check-label" for="radiobutton">
Male
</label>
<input class="form-check-input" type="radio" name="gender">
<label class="form-check-label" for="radiobutton">
Female
</label>
</div>
</div>
<div class="form-group">
<input class="form-control" name="images" type="file" value="">
</div>
<!-- Change this to a button or input when using this as a form -->
<input type="submit" value="Submit" class="btn btn-login"/>
</fieldset>
</form>
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4a5d00c8-9213-4e87-a3a6-d57dc3034e46n%40googlegroups.com.
No comments:
Post a Comment