Exemplo n.º 1
0
def new_brand():
    form = BrandForm()
    if form.validate_on_submit():
        brand = Brand()
        form.populate_obj(brand)
        db.session.add(brand)
        db.session.commit()
        flash(u'Marque sauvegardée avec succès', 'success')
        return redirect(url_for('brands'))
    return render_template('brand/edit.html',
                           form=form,
                           breadcrumb=[
                               (url_for('index'), 'Accueil'),
                               (url_for('brands'), 'Marques'),
                               (url_for('new_brand'), 'Nouvelle marque'),
                           ])
Exemplo n.º 2
0
Arquivo: brand.py Projeto: skitoo/arzo
def new_brand():
    form = BrandForm()
    if form.validate_on_submit():
        brand = Brand()
        form.populate_obj(brand)
        db.session.add(brand)
        db.session.commit()
        flash(u'Marque sauvegardée avec succès', 'success')
        return redirect(url_for('brands'))
    return render_template(
        'brand/edit.html',
        form=form,
        breadcrumb=[
            (url_for('index'), 'Accueil'),
            (url_for('brands'), 'Marques'),
            (url_for('new_brand'), 'Nouvelle marque'),
        ]
    )
Exemplo n.º 3
0
def edit_brand(brand_id):
    brand = Brand.query.get_or_404(brand_id)
    form = BrandForm(obj=brand)
    if form.validate_on_submit():
        form.populate_obj(brand)
        db.session.merge(brand)
        db.session.commit()
        flash(u'Marque sauvegardée avec succès', 'success')
        return redirect(url_for('brands'))
    return render_template('brand/edit.html',
                           form=form,
                           title='Marques - %s' % brand.name,
                           breadcrumb=[
                               (url_for('index'), 'Accueil'),
                               (url_for('brands'), 'Marques'),
                               (url_for('show_brand',
                                        brand_id=brand_id), brand.name),
                           ])
Exemplo n.º 4
0
Arquivo: brand.py Projeto: skitoo/arzo
def edit_brand(brand_id):
    brand = Brand.query.get_or_404(brand_id)
    form = BrandForm(obj=brand)
    if form.validate_on_submit():
        form.populate_obj(brand)
        db.session.merge(brand)
        db.session.commit()
        flash(u'Marque sauvegardée avec succès', 'success')
        return redirect(url_for('brands'))
    return render_template(
        'brand/edit.html',
        form=form,
        title='Marques - %s' % brand.name,
        breadcrumb=[
            (url_for('index'), 'Accueil'),
            (url_for('brands'), 'Marques'),
            (url_for('show_brand', brand_id=brand_id), brand.name),
        ]
    )