Esempio n. 1
0
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
    )
Esempio n. 2
0
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
    )
Esempio n. 3
0
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
    )
Esempio n. 4
0
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
    )