예제 #1
0
파일: views.py 프로젝트: TSS2/a
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))
예제 #2
0
파일: views.py 프로젝트: TSS2/test
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)
예제 #3
0
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)
예제 #4
0
파일: views.py 프로젝트: TSS2/a
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))
예제 #5
0
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))
예제 #6
0
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))
예제 #7
0
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)
예제 #8
0
파일: views.py 프로젝트: TSS2/test
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)
예제 #9
0
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)
예제 #10
0
파일: views.py 프로젝트: TSS2/a
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,
                           )
예제 #11
0
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,
    )
예제 #12
0
파일: views.py 프로젝트: TSS2/a
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))
예제 #13
0
파일: views.py 프로젝트: TSS2/a
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))
예제 #14
0
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))
예제 #15
0
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))