Exemplo n.º 1
0
def apply_create():
    form = ApplyForm()
    apply_data = request.form
    if request.method == 'POST':
        if form.validate_on_submit():
            apply_create = Event(
                title_cal=form.title_cal.data,
                title=form.title.data,
                host=form.host.data,
                category_char=apply_data['category_char'],
                category_host=apply_data['category_host'],
                date_start=apply_data['date_start'],
                date_end=apply_data['date_end'],
                link=form.link.data,
                location=form.location.data,
                content=form.content.data,
                contact=form.contact.data,
                contact_open=form.contact_open.data,
                poster=form.poster.data,
            )

            db.session.add(apply_create)
            db.session.commit()
            flash(u'이벤트 지원을 마쳤습니다.', 'success')
            return redirect(url_for('apply_list'))
    return render_template('apply/create.html',
                           form=form,
                           active_tab='apply_create')
Exemplo n.º 2
0
def apply_create():
    form = ApplyForm()
    apply_data = request.form
    if request.method == 'POST':
        if form.validate_on_submit():
            apply_create = Event(
                title_cal=form.title_cal.data,
                title=form.title.data,
                host=form.host.data,
                category_char=apply_data['category_char'],
                category_host=apply_data['category_host'],
                date_start=apply_data['date_start'],
                date_end=apply_data['date_end'],
                link=form.link.data,
                location=form.location.data,
                content=form.content.data,
                contact=form.contact.data,
                contact_open=form.contact_open.data,
                poster=form.poster.data,
            )

            db.session.add(apply_create)
            db.session.commit()
            flash(u'이벤트 지원을 마쳤습니다.', 'success')
            return redirect(url_for('apply_list'))
    return render_template('apply/create.html', form=form, active_tab='apply_create')
Exemplo n.º 3
0
def apply_update(id):
    apply_update = Event.query.get(id)
    form = ApplyForm(request.form, obj=apply_update)
    if request.method == 'POST':
        if form.validate_on_submit():
            form.populate_obj(apply_update)
            db.session.commit()
            return redirect(url_for('apply_detail', id=id))
    return render_template('apply/update.html', form=form)
Exemplo n.º 4
0
def apply_update(id):
    apply_update = Event.query.get(id)
    form = ApplyForm(request.form, obj=apply_update)
    if request.method == 'POST':
        if form.validate_on_submit():
            form.populate_obj(apply_update)
            db.session.commit()
            return redirect(url_for('apply_detail', id=id))
    return render_template('apply/update.html', form=form)