def awards_required_refuse(cid,id): # contest = Contest.get_by_id(id) # cid = contest.contest_id awards = Awards.get_by_id(id) awards.apply = int(5) awards.process = u'申请不通过' return redirect(url_for('admin.awards',id = cid))
def awards_edit(id, awards_id): contest = Contest.get_by_id(id) awards = Awards.get_by_id(awards_id) exist_resources = awards.resources awards_form = AwardsForm() if request.method == 'GET': awards_form.honor.data = awards.honor awards_form.level.data = awards.level awards_form.title.data = awards.title awards_form.type.data = awards.type if awards.teachers: teacher = awards.teachers[0] awards_form.teachers.data = teacher.name awards_form.students.data = [s.stu_no for s in awards.students] if request.method == 'POST' and awards_form.validate(): ret = Awards.update_awards(awards, awards_form, request.files) if ret == 'OK': return redirect(url_for('admin.awards', id=contest.id)) elif ret == 'FAIL': flash(u'提交失败') else: flash(ret) return render_template('admin/awards_form.html', title = u'奖项修改', contest = contest, awards_form = awards_form, exist_resources = exist_resources)
def awards_edit(id, awards_id): contest = Contest.get_by_id(id) awards = Awards.get_by_id(awards_id) exist_resources = awards.resources awards_form = AwardsForm() # if awards.apply == 3 or awards.apply == 5: # cid = contest.contest_id # Awards.set_all_apply_to_zero(cid) i = 1 if request.method == 'GET': awards_form.honor.data = awards.honor awards_form.level.data = awards.level awards_form.title.data = awards.title awards_form.type.data = awards.type # if awards.teachers: # teacher = awards.teachers[0] # awards_form.teachers.data = teacher.name awards_form.teachers.data = [t.name for t in awards.teachers] awards_form.students.data = [s.stu_no for s in awards.students] if request.method == 'POST' and awards_form.validate(): ret = Awards.update_awards(awards, awards_form, request.files) if ret == 'OK': return redirect(url_for('admin.awards', id=contest.id)) elif ret == 'FAIL': flash(u'提交失败') else: flash(ret) return render_template('admin/awards_form.html', title=u'奖项修改', contest=contest, awards_form=awards_form, exist_resources=exist_resources, awards=awards, i=i)
def awards_required_through(cid,id): # contest = Contest.get_by_id(id) # cid = contest.contest_id awards = Awards.get_by_id(id) awards.apply = int(4) awards.process = u'已审核' return redirect(url_for('admin.awards',id = cid))
def awards_required_refuse(cid, id): # contest = Contest.get_by_id(id) # cid = contest.contest_id awards = Awards.get_by_id(id) awards.apply = int(5) awards.process = u'申请不通过' return redirect(url_for('admin.awards', id=cid))
def awards_required_through(cid, id): # contest = Contest.get_by_id(id) # cid = contest.contest_id awards = Awards.get_by_id(id) awards.apply = int(4) awards.process = u'已审核' return redirect(url_for('admin.awards', id=cid))
def awards_check(id, awards_id): contest = Contest.get_by_id(id) awards = Awards.get_by_id(awards_id) exist_resources = awards.resources awards_form = AwardsForm() department = current_user.department if current_user.department != u'教务处' else None if request.method == 'GET': awards_form.honor.data = awards.honor awards_form.level.data = awards.level awards_form.title.data = awards.title awards_form.type.data = awards.type if awards.teachers: teacher = awards.teachers[0] awards_form.teachers.data = teacher.name awards_form.students.data = [s.stu_no for s in awards.students] if request.method == 'POST' and awards_form.validate(): ret = Awards.update_awards(awards, awards_form, request.files) if ret == 'OK': return redirect(url_for('admin.awards', id=contest.id)) elif ret == 'FAIL': flash(u'提交失败') else: flash(ret) return render_template('admin/awards_form_check.html', title=u'奖项查看', contest=contest, awards_form=awards_form, awards=awards, exist_resources=exist_resources, department=department)
def awards_del(): awards_id = request.form.get('awards_id', -1) if awards_id != -1: awards = Awards.get_by_id(awards_id) ret = Awards.delete_awards(awards) else: ret = u'删除失败' return jsonify(ret = ret)
def awards_del(): awards_id = request.form.get('awards_id', -1) if awards_id != -1: awards = Awards.get_by_id(awards_id) ret = Awards.delete_awards(awards) else: ret = u'删除失败' return jsonify(ret=ret)
def awards_check_after_pass(id, awards_id): contest = Contest.get_by_id(id) awards = Awards.get_by_id(awards_id) exist_resources = awards.resources return render_template('admin/awards_see.html', title = u'奖项查看1', contest = contest, awards = awards, exist_resources = exist_resources, )
def awards_check_after_pass(id, awards_id): contest = Contest.get_by_id(id) awards = Awards.get_by_id(awards_id) exist_resources = awards.resources return render_template( 'admin/awards_see.html', title=u'奖项查看1', contest=contest, awards=awards, exist_resources=exist_resources, )
def awards_check_refuse(id,awards_id): awards = Awards.get_by_id(awards_id) awards.apply = 2 #apply表示审核不通过 awards.process = u'审核不通过' awards.save() return redirect(url_for('admin.awards',id = id))
def awards_check_pass(id,awards_id): awards = Awards.get_by_id(awards_id) awards.apply = 1 #apply表示已审核 awards.process = u'已审核' awards.save() return redirect(url_for('admin.awards',id = id))
def awards_check_refuse(id, awards_id): awards = Awards.get_by_id(awards_id) awards.apply = 2 #apply表示审核不通过 awards.process = u'审核不通过' awards.save() return redirect(url_for('admin.awards', id=id))
def awards_check_pass(id, awards_id): awards = Awards.get_by_id(awards_id) awards.apply = 1 #apply表示已审核 awards.process = u'已审核' awards.save() return redirect(url_for('admin.awards', id=id))