def series_del(): series_id = request.form.get('series_id', -1, type=int) if series_id != -1: series = ContestSeries.get_by_id(series_id) ret = ContestSeries.delete_series(series) else: ret = u'删除失败' return jsonify(ret = ret)
def series_del(): series_id = request.form.get('series_id', -1, type=int) if series_id != -1: series = ContestSeries.get_by_id(series_id) ret = ContestSeries.delete_series(series) else: ret = u'删除失败' return jsonify(ret=ret)
def series_edit(id): series = ContestSeries.get_by_id(id) series_form = ContestSeriesForm() if request.method == 'GET': series_form.name.data = series.name if request.method == 'POST' and series_form.validate(): ret = ContestSeries.update_series(series, series_form) if ret == 'OK': return redirect(url_for('admin.series')) elif ret == 'FAIL': flash(u'提交失败') else: flash(ret) return render_template('admin/series_form.html', title = u'竞赛系列修改', action = url_for('admin.series_edit', id=id), series_form = series_form)
def series_edit(id): series = ContestSeries.get_by_id(id) series_form = ContestSeriesForm() if request.method == 'GET': series_form.name.data = series.name series_form.budget_text.data = series.budget_text if request.method == 'POST' and series_form.validate(): ret = ContestSeries.update_series(series, series_form) if ret == 'OK': return redirect(url_for('admin.series')) elif ret == 'FAIL': flash(u'提交失败') else: flash(ret) return render_template('admin/series_form.html', title=u'竞赛系列修改', action=url_for('admin.series_edit', id=id), series_form=series_form)