コード例 #1
0
def post():
    if request.method == 'POST':
        title = request.form['title']
        start = request.form['start']
        end = request.form['end']
        fee = request.form['fee']
        capacity = request.form['capacity']
        detail = request.form['detail']
        status = 'OPEN'
        early_period = request.form['early_period']

        try:
            Eventsystem.check_start(start)
            Eventsystem.check_data(start, end)
            Eventsystem.valida_seminar_capa(capacity)
            Eventsystem.validate_period(start, end, early_period)
            event = Eventsystem.make_course(title, detail, start, end,
                                            capacity, status,
                                            current_user.name, fee,
                                            early_period)
            Eventsystem.add_course(event)
            return redirect(url_for('index'))
        except ErrorMessage as error:
            return render_template('post.html',
                                   val_post=True,
                                   post_info=error.msg)
    return render_template('post.html')
コード例 #2
0
def cancele(eventId):
    event = Event.query.filter_by(event_id=int(eventId)).one()
    Eventsystem.remove_all_user(event)
    event.status = 'CANCELED'
    Eventsystem.add_course(event)
    return redirect(url_for('index'))