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)
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)
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)
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)
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)
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)
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)
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)
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)