def newhm_submit(club):
'''Input HongMei plan into databse'''
contents = request.form['contents']
try:
actdate = date(int(request.form['year']),
int(request.form['month']),
int(request.form['day']))
except ValueError:
fail('Please input valid date to submit.', 'newhm')
if contents == '' or actdate < date.today():
fail('Please input contents or correct date to submit.', 'newhm')
if form_is_valid():
a = Activity.new()
a.name = contents
a.club = club
a.description = FormattedText.emptytext()
a.date = actdate
a.time = ActivityTime.HONGMEI
a.location = 'HongMei Elementary School'
a.cas = 1
a.post = FormattedText.emptytext()
a.selections = []
a.create()
return redirect(url_for('.newhm', club=club.callsign))
评论列表
文章目录