Beispiel #1
0
def addjob():
    form = AddJobForm()
    if form.validate_on_submit():
        form.create_job(company=current_user)
        flash('职位添加成功','success')
        return redirect(url_for('job.admin'))
    return render_template('job/addjob.html', form=form)
Beispiel #2
0
def updatejob(jobid):
    job = Job.query.get_or_404(jobid)
    form = AddJobForm(obj=job)  # 用表对象填充表单模型对象
    if form.validate_on_submit():
        form.updatejob(job)
        flash('职位更新成功', 'success')
        return redirect(url_for('.index'))
    return render_template('job/updatejob.html', form=form, job=job)
Beispiel #3
0
def addjob():
    form = AddJobForm()
    if form.validate_on_submit():
        form.addjob()
        flash('职位添加成功', 'success')
        return redirect(url_for('.index'))

    return render_template('job/createjob.html', form=form)
Beispiel #4
0
def updatejob(jobid):
    job = Job.query.get_or_404(jobid)
    form = AddJobForm(obj=job)
    if form.validate_on_submit():
        form.updatejob(job)
        flash('{} 职位下线成功'.format(job.name), 'success')
        return redirect(url_for('admin.jobs'))
    return render_template('job/updatejob.html', form=form, job=job)
Beispiel #5
0
def addjob(cid):
    company = Company.query.get_or_404(cid)
    form = AddJobForm()
    if form.validate_on_submit():
        form.addjob(company)
        flash('职位添加成功', 'success')
        return redirect(url_for('company.admin'))
    return render_template('job/createjob.html', form=form, cid=cid)
Beispiel #6
0
def addjob(user_id):
    user = User.query.get(user_id)
    company = user.company
    form = AddJobForm()
    if form.validate_on_submit():
        form.addjob(company=company)
        flash('职位添加成功', 'success')
        return redirect(url_for('admin.jobs'))
    return render_template('job/createjob.html', form=form, user_id=user_id)
Beispiel #7
0
def editjob(job_id):
    job = Job.query.get_or_404(job_id)
    #判断当前用户是否合法
    if not current_user.id == job.company_id:
        abort(404)
    form = AddJobForm(obj=job)
    if form.validate_on_submit():
        form.update_job(job)
        flash('职位更新成功','success')
        return redirect(url_for('job.admin'))
    return render_template('job/editjob.html',form=form,job=job)
Beispiel #8
0
def updatejob(cid, jobid):
    company = Company.query.get_or_404(cid)
    job = Job.query.get_or_404(jobid)

    form = AddJobForm(obj=job)  # 用表对象填充表单模型对象
    if form.validate_on_submit():
        form.updatejob(company, job)
        flash('职位更新成功', 'success')
        return redirect(url_for('company.admin'))

    return render_template('job/updatejob.html', form=form, cid=cid, job=job)
Beispiel #9
0
def job_add():
    form = AddJobForm()
    if form.validate_on_submit():
        form.create_job()
        return redirect(url_for('.jobs'))
    return render_template('admin/add_job.html', form=form)