def add(): form = JobForm() if request.method == 'POST' and form.validate_on_submit(): new_job = Job() form.populate_obj(new_job) new_job.put() return redirect(url_for('about.admins.jobs.index')) jobs = Job.query().order(-Job.created) return render_template( 'about/admins/jobs/add.html', jobs=jobs, form=form )
def upload_resume(key_id): job = Job.retrieve_by_id(key_id) if not job or not job.is_public: return redirect(url_for('about.jobs')) form = ResumeForm() if request.method == 'POST' and form.validate_on_submit(): resume = Resume() form.populate_obj(resume) resume.vacancy = job.key upload_files = get_uploads(request, 'attach_file_') if len(upload_files): blob_info = upload_files[0] if blob_info.size: file_ = File.create( blob_info.key(), size=blob_info.size, filename=os.path.basename(blob_info.filename.replace('\\','/')), content_type=blob_info.content_type) file_.put() resume.attach_file = file_.key else: blob_info.delete() resume.put() return render_template('about/resume_thanks.html', html_class='about_class') upload_url = blobstore.create_upload_url(url_for('about.upload_resume', key_id=key_id)) return render_template( 'about/job.html', html_class='about_page', job=job, form=form, upload_url=upload_url, is_send_form=True )
def show_jobs(): jobs = Job.query(Job.is_public == True).order(-Job.created) return render_template( 'about/jobs.html', html_class='about_page', jobs=jobs )
def resume(key_id): job = Job.retrieve_by_id(key_id) if not job: return redirect(url_for('about.admins.jobs.index')) resumes = Resume.query(Resume.vacancy == job.key) return render_template( 'about/admins/jobs/resume.html', job=job, resumes=resumes )
def get_job(key_id): job = Job.retrieve_by_id(key_id) if not job or not job.is_public: return redirect(url_for('about.jobs')) form = ResumeForm() upload_url = blobstore.create_upload_url(url_for('about.upload_resume', key_id=key_id)) return render_template( 'about/job.html', html_class='about_page', job=job, form=form, upload_url=upload_url )
def edit_job(key_id): job = Job.retrieve_by_id(key_id) if not job: return redirect(url_for('about.admins.jobs.index')) if 'delete_contact' in request.form: job.key.delete() return redirect(url_for('about.admins.jobs.index')) form = JobForm(obj=job) if request.method == 'POST' and form.validate_on_submit(): form.populate_obj(job) job.put() return redirect(url_for('about.admins.jobs.index')) return render_template( 'about/admins/jobs/edit.html', form=form )
def index(): jobs = Job.query().order(-Job.created) return render_template( 'about/admins/jobs/index.html', jobs=jobs )