def apply(request, listing_type=None, job_recommendation_id=None, job_index=1, job_total=1, template=None): if request.method == 'POST': fields = request.POST else: fields = request.GET form = HandleFragmentForm(fields) context = {} context['form'] = form context['job_index'] = int(job_index) context['job_total'] = int(job_total) call = Call.objects.get(call_sid=fields['CallSid']) recommendation = JobRecommendation.objects.get(id=job_recommendation_id) applications = ApplicantJob.objects.filter(job=recommendation.job, applicant=recommendation.applicant) if applications.count() == 0: application = ApplicantJob(job=recommendation.job, applicant=recommendation.applicant) application.save() context['recommendation'] = recommendation context['listing_type'] = listing_type fragment = CallFragment(call=call, outbound=True, fragment_type=CallFragment.OUTBOUND_ENTER_PASSWORD) fragment.save() return render_to_response(template, context, context_instance=RequestContext(request))
def do_job_apply(response, profile): try: job = Job.objects.get(job_code=response) applications = ApplicantJob.objects.filter(job=job, applicant=profile) if applications.count() == 0: application = ApplicantJob(job=job, applicant=profile) application.save() except Job.DoesNotExist: job = None return { 'job': job }
def run(self): counter = 0 for job in self.jobs: new_job = Job( title=job.title, description=job.description, employer=self.profile, availability=job.availability, experience=job.experience, education=job.education, employment_type=job.employment_type, overtime=job.overtime, latitude=job.latitude, longitude=job.longitude, ) new_job.save() new_job.workday = job.workday.all() new_job.industry = job.industry.all() new_job.save() new_location = JobLocation( business_name=job.location.business_name, business_address1=job.location.business_address1, business_address2=job.location.business_address2, city=job.location.city, zip_code=job.location.zip_code, latitude=job.location.latitude, longitude=job.location.longitude, job=new_job, ) new_location.save() for existing_profile in self.profiles: rec = JobRecommendation( job=new_job, applicant=existing_profile, state=(JobRecommendation.NEW_REC_SENT if counter > 2 else JobRecommendation.APPLIED_REC), ) rec.save() if counter <= 2: application = ApplicantJob(job=new_job, applicant=existing_profile, send_email=False) application.save() if existing_profile.id == 24 and job.id == 12: application = ApplicantJob(job=new_job, applicant=existing_profile, send_email=False) application.save() counter = counter + 1 counter = 0