Ejemplo n.º 1
0
def edit_page(page_id):
    upload_url = url_for('admin.upload')
    query_edit_page = Content.query.filter(Content.id ==
                                           page_id).first_or_404()
    form = AddPage(obj=query_edit_page)
    action = url_for('admin.edit_page', page_id=page_id)
    if form.validate_on_submit():
        form.populate_obj(query_edit_page)
        db.session.commit()
        flash('Page edited')
        return redirect(url_for('admin.pages'))
    return render_template('backend/pages_actions.html',
                           title=u'Editar página',
                           form=form,
                           action=action,
                           upload_url=upload_url)
Ejemplo n.º 2
0
def edit_page(page_id):
    upload_url = url_for('admin.upload')
    query_edit_page = Content.query.filter(
        Content.id == page_id).first_or_404()
    form = AddPage(obj=query_edit_page)
    action = url_for('admin.edit_page', page_id=page_id)
    if form.validate_on_submit():
        form.populate_obj(query_edit_page)
        db.session.commit()
        flash('Page edited')
        return redirect(url_for('admin.pages'))
    return render_template('backend/pages_actions.html',
                           title=u'Editar página',
                           form=form,
                           action=action,
                           upload_url=upload_url)
Ejemplo n.º 3
0
def add_page():
    """ Add page to the application
    """
    form = AddPage()
    action = url_for('admin.add_page')
    upload_url = url_for('admin.upload')
    if form.validate_on_submit():
        content = Content(title=form.title.data,
                          description=form.description.data,
                          content_type=form.content_type.data,
                          is_on_user_menu=form.is_on_user_menu.data,
                          tag=form.tag.data,
                          active=form.active.data)
        db.session.add(content)
        db.session.commit()
        flash('Page created')
        return redirect(url_for('admin.pages'))
    return render_template('backend/pages_actions.html',
                           form=form,
                           title=u'Añadir página',
                           action=action,
                           upload_url=upload_url)
Ejemplo n.º 4
0
def add_page():
    """ Add page to the application
    """
    form = AddPage()
    action = url_for('admin.add_page')
    upload_url = url_for('admin.upload')
    if form.validate_on_submit():
        content = Content(title=form.title.data,
                          description=form.description.data,
                          content_type=form.content_type.data,
                          is_on_user_menu=form.is_on_user_menu.data,
                          tag=form.tag.data,
                          active=form.active.data)
        db.session.add(content)
        db.session.commit()
        flash('Page created')
        return redirect(url_for('admin.pages'))
    return render_template('backend/pages_actions.html',
                           form=form,
                           title=u'Añadir página',
                           action=action,
                           upload_url=upload_url)