Esempio n. 1
0
def admin_publish_job(company_id):
    if current_user.id != company_id:
        abort(404)
    form = JobForm()
    if form.validate_on_submit():
        form.create_job(current_user)
        flash('职位创建成功', 'success')
        return redirect(url_for('company.admin_index', company_id=current_user.id))
    return render_template('company/publish_job.html', form=form, company_id=company_id)
Esempio n. 2
0
def job_edit(company_id):
    job = Job.query.filter_by(company_id=company_id).first()
    form = JobForm(obj=job)
    if form.validate_on_submit():
        form.update_job(job)
        flash('职位更新成功', 'success')
        return redirect(url_for('company.manage_job', company_id=company_id))
    return render_template('company/job_edit.html',
                           form=form,
                           company_id=company_id)
Esempio n. 3
0
def edit_job(job_id):
    job = Job.query.get_or_404(job_id)  #首先找到当前要修改的job
    if not current_user.company.id == job.company_id:
        abort(404)
    form = JobForm(obj=job)
    if form.validate_on_submit():
        form.edit_job(job_id)  #传入要修改的job_id
        flash('工作更新成功', 'success')
        return redirect(url_for('company.edit_job', job_id=job_id))
    return render_template('company/edit_job.html', form=form, job=job)
Esempio n. 4
0
def admin_edit_job(company_id, job_id):
    job = Job.query.get_or_404(job_id)
    if current_user.id != company_id or job.company_id != current_user.id:
        abort(404)
    form = JobForm(obj=job)
    if form.validate_on_submit():
        form.update_job(job)
        flash('职位更新成功', 'success')
        return redirect(url_for('company.admin_index', company_id=company_id))
    return render_template('company/admin_edit_job.html', form=form, company_id=company_id, job=job)
Esempio n. 5
0
def admin_addjob(company_id):
    company = Company.query.get_or_404(company_id)
    form = JobForm()
    if form.validate_on_submit():
        form.create_job(company)
        flash('职位发布成功!', 'success')
        return redirect(url_for('.admin_index', company_id=company.id))
    return render_template('company/admin_addjob.html',
                           form=form,
                           company=company)
Esempio n. 6
0
def admin_add_job(company_id):
    if current_user.id != company_id:
        abort(404)
    form = JobForm()
    if form.validate_on_submit():
        job = form.create_job(current_user)
        db.session.add(job)
        db.session.commit()
        flash('职位创建成功', 'success')
        return redirect(url_for('company.admin_index', company_id=current_user.id))
    return render_template('company/admin_add_job.html', form=form, company_id=company_id)
Esempio n. 7
0
def job_edit(job_id):
    if current_user.role != 20:
        abort(404)
    job = Job.query.get_or_404(job_id)
    if job.company_id != current_user.id:
        abort(404)
    form = JobForm(obj=job)
    if form.validate_on_submit():
        form.update_job(job)
        flash('职位更新成功!', 'success')
        return redirect(url_for('company.company_admin'))
    return render_template('company/job_edit.html', form=form, job=job)
Esempio n. 8
0
def admin_editjob(company_id, job_id):
    company = Company.query.get_or_404(company_id)
    job = Job.query.get_or_404(job_id)
    form = JobForm(obj=job)
    if form.validate_on_submit():
        form.update_job(job)
        flash('职位更新成功!', 'success')
        return redirect(url_for('.admin_index', company_id=company.id))
    return render_template('company/admin_editjob.html',
                           form=form,
                           company=company,
                           job=job)
Esempio n. 9
0
def admin_edit_job(companyID, jobID):
    if current_user.id != companyID:
        abort(404)
    jobObject = Job.query.get_or_404(jobID)
    if jobObject.companyID != companyID:
        abort(404)
    form = JobForm(obj=jobObject)
    if form.validate_on_submit():
        form.update_job(jobObject)
        flash('职位更新成功', 'success')
        return redirect(url_for('company.admin_index', companyID=companyID))
    return render_template('company/edit_job.html', form=form, companyID=companyID, job=jobObject)
Esempio n. 10
0
def admin_edit_job(company_id, job_id):
    if current_user.id != company_id:
        abort(404)
    job = Job.query.get_or_404(job_id)
    if job.company_id != current_user.id:
        abort(404)
    form = JobForm(obj=job)
    if form.validate_on_submit():
        form.update_job(job)
        flash('职位更新成功', 'success')
        return redirect(url_for('company.admin_index', company_id=current_user.id))
    return render_template('company/edit_job.html', form=form, company_id=company_id, job=job)
Esempio n. 11
0
def admin_publish_job(company_id):
    if current_user.id != company_id:
        abort(404)
    form = JobForm()
    if form.validate_on_submit():
        form.create_job(current_user)
        flash('Create Job Success', 'success')
        return redirect(
            url_for('company.admin_index', company_id=current_user.id))
    return render_template('company/publish_job.html',
                           form=form,
                           company_id=company_id)
Esempio n. 12
0
def publish_job(company_id):
    if current_user.company.id != company_id:
        abort(404)

    form = JobForm()

    if form.validate_on_submit():
        form.create_job(current_user.company)
        flash('新增职位成功', 'success')
        return redirect(url_for('company.admin', company_id=company_id))
    return render_template('company/publish_job.html',
                           company_id=company_id,
                           form=form)
Esempio n. 13
0
def publish_job():
    """
    发布职位
    """
    company = Company.query.filter(Company.user == current_user).first()
    form = JobForm()
    if form.validate_on_submit():
        form.create_job(company)
        flash("职位创建成功", "success")
        return redirect(url_for("company.manage_job"))
    return render_template("company/publish_job.html",
                           form=form,
                           company_id=company.id)
Esempio n. 14
0
def edit_job():
    """
    编辑职位
    """
    job_id = request.args.get("job_id", "")
    job = Job.query.get_or_404(job_id)
    company_id = Company.query.filter_by(user_id=current_user.id).value("id")
    if job.company_id != company_id:
        abort(404)
    form = JobForm(obj=job)
    if form.validate_on_submit():
        form.update_job(job)
        flash("职位更新成功", "success")
        return redirect(url_for("company.manage_job"))
    return render_template("company/edit_job.html", form=form, job=job)
Esempio n. 15
0
def create_job():
    form = JobForm()
    form.update_companylist()
    if form.validate_on_submit():
        form.create_job()
        flash('Job create success', 'success')
        return redirect(url_for('admin.joblist'))
    return render_template('admin/create_job.html', form=form)
Esempio n. 16
0
def edit_job(job_id):
    job = Job.query.get_or_404(job_id)
    form = JobForm(obj=job)
    form.update_companylist()
    if form.validate_on_submit():
        form.update_job(job)
        flash('User update success', 'success')
        return redirect(url_for('admin.joblist'))
    return render_template('admin/edit_job.html', form=form, job=job)
Esempio n. 17
0
def create_job():
    company_id = current_user.company.id
    form = JobForm()
    form.update_companylist()
    form.company_id.data = company_id
    if form.validate_on_submit():
        form.create_job()
        flash('Job create success', 'success')
        return redirect(url_for('company.admin_jobs'))
    return render_template('company/admin/add_job.html', form=form)
Esempio n. 18
0
def job_edit():
    job_id = request.args.get('job_id')
    try:
        job_id = int(job_id)
    except TypeError:
        pass
    if job_id:
        job = Job.query.get_or_404(job_id)
        form = JobForm(obj=job)
        if form.validate_on_submit():
            form.populate_obj(job)
            form.create_job(job)
            flash('修改成功', 'success')
            return redirect(url_for('company.job'))
    else:
        job = Job()
        form = JobForm()
    if form.validate_on_submit():
        # 增加缺少的数据
        job_id = Company.query.filter_by(user_id=current_user.id).id
        job.id = job.job_id
        job.state = 1
        form.populate_obj(job)
        form.create_job(job)
        flash('创建成功', 'success')
    return render_template('company/admin_job_edit.html', form=form)
Esempio n. 19
0
def new():
    form = JobForm()
    if form.validate_on_submit():
        form.create_job()
        return redirect(url_for('job.admin'))
    return render_template('job/create_job.html', form=form)