def apply(request, company_id): if not request.user.is_authenticated(): return HttpResponseRedirect('/index') elif request.method == 'POST': company = Company.objects.filter(id=company_id) status = "Applied" name = request.POST['name_applicant'] cv = request.POST['cv_applicant'] recruiter = request.user.id temp = Resume(name_applicant=name,cv_applicant=cv,status_application=status,company_applied=company[0],recruiter_id=recruiter) temp.save() return HttpResponseRedirect('/company/') else: return render(request,'apply.html')
def apply(request, company_id): if not request.user.is_authenticated(): return HttpResponseRedirect('/') elif request.method == 'POST': company = Company.objects.filter(id=company_id) position_applied = company[0].job_title recruiter = request.user.id name = request.POST["name_applicant"] email = request.POST["email_applicant"] mobile = request.POST["mobile_applicant"] current_company = request.POST["current_applicant_company"] current_salary = request.POST["current_applicant_salary"] cv = request.POST["cv_applicant"] temp = Resume(name_applicant=name,current_company=current_company,current_salary=current_salary,emailid=email,mobile=mobile,resume=cv,company_applied=company[0],position_applied=position_applied,recruiter_id=recruiter) temp.save() messages.success(request, 'Resume of candidate uploaded') return HttpResponseRedirect('/company/') else: companyObject = Company.objects.filter(id=company_id) return render(request,'apply.html',{'item':companyObject[0]})