예제 #1
0
파일: views.py 프로젝트: oksana-slu/sqlfla
def create_story():
    story_form = EventStoryForm(request.form or None)

    if request.form and story_form.validate():
        story_form.save()
        return redirect(url_for('.list_stories'))

    return render_template('events/create_story.html', story_form=story_form)
예제 #2
0
파일: views.py 프로젝트: oksana-slu/sqlfla
def edit_story(id):
    story = EventStory.query.get_or_404(id)
    story_form = EventStoryForm(request.form or None, obj=story)

    if request.form and story_form.validate():
        story_form.save(story)
        return redirect(url_for('.list_stories'))

    return render_template('events/edit_story.html', story_form=story_form,
                           story=story)