Exemplo n.º 1
0
def create_project():
    form = ProjectForm()
    if form.validate_on_submit():
        form.save()
        flash('Project saved on the database')
        return redirect(url_for('list_projects'))
    return render_template('admin/projects/new.html', form=form)
Exemplo n.º 2
0
def update_project(slug):
    project = Project.all().filter('slug =', slug).get()
    form = ProjectForm()
    if form.validate_on_submit():
        form.model = project
        form.save()
        flash('Project updated')
        return redirect(url_for('list_projects'))
    return render_template('admin/projects/edit.html', form=form, project=project)