Beispiel #1
0
def folder_new(website):
    g.website = website
    form = FolderForm()
    themes = [('', 'Website Default')] + [(t.identifier, t.name) for t in get_themes_list()]
    form.theme.choices = themes
    if form.validate_on_submit():
        folder = Folder(website=website)
        form.populate_obj(folder)
        db.session.add(folder)
        db.session.commit()
        return render_redirect(url_for('folder', website=website.name, folder=folder.name), code=303)
    return render_form(form=form, title=u"New folder", submit=u"Create",
        cancel_url=url_for('website', website=website.name), ajax=True)
Beispiel #2
0
def folder_edit(website, folder):
    g.website = website
    g.folder = folder
    form = FolderForm(obj=folder)
    if request.method == 'GET':
        form.theme.data = folder._theme
    themes = [('', 'Website Default')] + [(t.identifier, t.name) for t in get_themes_list()]
    form.theme.choices = themes
    if form.validate_on_submit():
        form.populate_obj(folder)
        db.session.commit()
        return render_redirect(url_for('folder', website=website.name, folder=folder.name), code=303)
    return render_form(form=form, title=u"Edit folder", submit=u"Save",
        cancel_url=url_for('folder', website=website.name, folder=folder.name), ajax=True)
Beispiel #3
0
def folder_new(website):
    g.website = website
    form = FolderForm()
    themes = [('', 'Website Default')] + [(t.identifier, t.name)
                                          for t in get_themes_list()]
    form.theme.choices = themes
    if form.validate_on_submit():
        folder = Folder(website=website)
        form.populate_obj(folder)
        db.session.add(folder)
        db.session.commit()
        return render_redirect(url_for('folder',
                                       website=website.name,
                                       folder=folder.name),
                               code=303)
    return render_form(form=form,
                       title=u"New folder",
                       submit=u"Create",
                       cancel_url=url_for('website', website=website.name),
                       ajax=True)
Beispiel #4
0
def folder_edit(website, folder):
    g.website = website
    g.folder = folder
    form = FolderForm(obj=folder)
    if request.method == 'GET':
        form.theme.data = folder._theme
    themes = [('', 'Website Default')] + [(t.identifier, t.name)
                                          for t in get_themes_list()]
    form.theme.choices = themes
    if form.validate_on_submit():
        form.populate_obj(folder)
        db.session.commit()
        return render_redirect(url_for('folder',
                                       website=website.name,
                                       folder=folder.name),
                               code=303)
    return render_form(form=form,
                       title=u"Edit folder",
                       submit=u"Save",
                       cancel_url=url_for('folder',
                                          website=website.name,
                                          folder=folder.name),
                       ajax=True)