Esempio n. 1
0
def store_info(store_number):
	if request.method == 'POST':
		new_store_name = request.form['new_store_name']
		Store.update({Store.name: new_store_name}).where(Store.id == store_number)
		return redirect(url_for('store/index'))
	else:
		store_id = Store.select().where(Store.id == store_number)
		num_of_wh = True
		for store in store_id:
			num_of_wh = len(list(store.warehouses))
		return render_template('store_page.html', store_id=store_id, num_of_wh=num_of_wh)
Esempio n. 2
0
def store_edit(id):
    ns = request.form.get("ns")

    upd_store = Store.update(name=ns).where(Store.id == id)
    upd_store.execute()

    return redirect(url_for('ind_store_select', id=id))
Esempio n. 3
0
def update(id):
    store = Store.update(name=request.form['store_name']).where(Store.id == id)
    store_id = Store.get_by_id(id)
    if store.execute():
        flash('Succesfully updated store name!', 'success')
        return redirect(url_for('edit', store=store, id=store_id))
    else:
        flash('Failed to update store name :/', 'danger')
        return redirect(url_for('update'))
Esempio n. 4
0
def update(id_num):
    update_name = Store.update(name=request.form["chg_store_name"]).where(
        Store.id == id_num)
    try:
        update_name.execute()
        flash("Name has been changed! :)")
        return redirect("/stores")
    except:
        flash("Attempt unsuccessful! :(")
        return redirect("url_for('update',id_num)")
Esempio n. 5
0
def edit(id):
    s = Store.update(name=request.form['name']).where(Store.id == id)

    #s is equal to the class with the name from the html button
    #pulling the informatino from form, not args

    if s.execute():
        flash("flash saved")
        return redirect(url_for('stores_about'))
    else:
        return render_template('store.html', name=request.args['name]'])
Esempio n. 6
0
def update_store(id):
    old_name = Store.get(id=id).name
    new_store_name = Store.update(name=request.form.get("name")).where(
        Store.name == old_name)

    if new_store_name.execute():
        flash(f"Successfully updated")
        # have to pass in id as id, since def show_store(id):
        return redirect(url_for("show_store", id=id))
    else:
        flash("That name is already taken")
        return render_template("show_store.html")
Esempio n. 7
0
def edit_store(sid):
    new_name = Store.update(name=request.form.get('new_name')).where(
        Store.id == sid)
    new_name.execute()
    return redirect(url_for('store'))