Esempio n. 1
0
File: views.py Progetto: kosc/neobug
def create():
    page = Page()
    form = PageForm(request.form)
    if form.validate_on_submit():
        form.populate_obj(page)
        page.save()
        return redirect('/wiki/')
    return render_template('wiki_create.html',
                           title="Wiki - create new page",
                           page=page,
                           form=form)
Esempio n. 2
0
File: views.py Progetto: kosc/neobug
def edit(page_id):
    page = Page.objects.with_id(page_id)
    form = PageForm(request.form, page)
    if form.validate_on_submit():
        form.populate_obj(page)
        page.save()
        return redirect('/wiki/')
    return render_template('wiki_edit.html',
                           title="Wiki - edit page "+page.title,
                           page=page,
                           form=form)