def warehouse_create(): store = Store.get_by_id(request.form['store_id']) w = Warehouse(location=request.form['warehouse_location'], store=store) w.save() if w.save(): flash("Warehouse created") return redirect(url_for('warehouse_new'))
def add_warehouse(): store = Store.get(Store.name == request.form["store_select"]) w = Warehouse(location=request.form["location"], store=store) try: w.save() flash("Successfully saved!") return redirect("/") except: flash("Warehouse exists! Trash!") return redirect("/warehouse")
def warehouse_create(): location = request.form.get('location') store = Store.get_by_id(request.form['store_id']) warehouse = Warehouse(location=location, store=store) if warehouse.save(): flash("Warehouse created!", "success") return redirect(url_for('warehouse_new'))
def warehouse_update(id): updated_wh = Warehouse(warehouse_id=id, location=request.form['location']) if updated_wh.save(only=[Warehouse.location]): flash("Successfully updated!", 'success') else: flash("Something went wrong, check your internet and try again", 'danger') return redirect(url_for('warehouse_show', id=id))
def warehouse_create(): w = Warehouse(store=request.form.get("store_id"), location=request.form.get("location")) if w.save(): flash("Warehouse created.", "success") else: flash("Unable to create warehouse.", "danger") return redirect(url_for("warehouse_new"))
def create_warehouse(): store = request.form['store_id'] w = Warehouse(location=request.form['warehouse_location'], store=store) if w.save(): flash("successfully save") return redirect(url_for('warehouse')) else: return render_template('warehouse.html', name=request.form.get('store_location'))
def warehouse_created(): store = request.form.get("store_id") location = request.form.get("location") w = Warehouse(store=store, location=location) if w.save(): flash("Warehouse Created!", "success") else: flash("Warehouse Duplicated", "danger") return redirect(url_for('warehouse_new'))
def warehouse_create(): location = request.form.get('wh_location') wh = Warehouse(location=location, store_id=1) if wh.save(): flash(f"Warehouse at {location} has been created!", 'danger') else: flash('Something went wrong!') return redirect('/')
def create_warehouse(): storeid = request.form.get("storeid") warehouseloc = request.form.get("warehouse_location") whouse = Warehouse(location=warehouseloc, store_id=storeid) if whouse.save(): flash(f"Warehouse {warehouseloc} saved at Store {storeid}") return redirect(url_for("new_warehouse")) else: flash("That name is already taken") return render_template("warehouse.html")
def w_create(): store_id = Store.get_by_id(request.form.get('s_id')) warehouse_name = request.form.get('warehouse_name') w = Warehouse(location=warehouse_name, store=store_id) if w.save(): flash(f"Successfully saved {warehouse_name}") return redirect(url_for('warehouse')) else: return render_template('warehouse', location=warehouse_name)
def warehouse_create(): location = request.form.get('warehouse_location') store_id = request.form.get('store_id') store =Store.get(Store.id == store_id) w = Warehouse(location=location, store=store) if w.save(): return redirect(url_for('warehouse')) else: return render_template('warehouse.html')
def create_warehouse(): location = request.form['location'] store_id = Store.get(Store.name == request.form['store_name']) warehouse = Warehouse(location=location, store_id=store_id) if warehouse.save(): flash('Succesfully created warehouse!', "success") return render_template('index.html') else: flash('Failed to create warehouse', "danger") return redirect(url_for('show_warehouse'))
def create_warehouse(): if request.method == "POST": store = Store.get_by_id(request.form['store_id']) w = Warehouse(location=request.form['warehouse_location'], store=store) if w.save(): flash( f"{store.name} added a new warehouse at {request.form['warehouse_location']}." ) return redirect(url_for('new_warehouse')) else: return render_template('warehouse.html', location=request.form['warehouse_location'])
def create_warehouse(): w_location = request.form.get('w_location') s_id = Store.get_by_id(request.form.get('s_id')) w = Warehouse(location=w_location, store=s_id) if w.save(): flash("successfully saved") return redirect(url_for('warehouse')) else: return render_template('warehouse.html', name=request.form['name'], errors=s.errors)
def warehouse_form(): store_id = request.form.get('store_id') warehouse_location = request.form.get('location_name') # breakpoint() # store = Store.get_by_id(store_id) #if wanna pass Warehouse first argument as instance new_warehouse = Warehouse(store_id = store_id, location=warehouse_location) if new_warehouse.save(): return redirect(url_for('warehouse')) else: return render_template('warehouse.html', store_id = store_id, warehouse_location = warehouse_location)
def w_create(): w = Warehouse(location=request.form['location'], store=request.form['store_choice']) #Warehouse is the class #location for Warehouse class is from html(name='location') from form if w.save(): flash("flash saved") return redirect(url_for('warehouse')) else: return render_template('warehouse.html', name=request.args['location]'])
def warehouse_create(): warehouse_location = request.form.get('warehouse_location') store_id = request.form.get('store_id') warehouse = Warehouse(location=warehouse_location, store=store_id) if warehouse.save(): flash(f"Added Warehouse: {warehouse_location}") return redirect(url_for('warehouse_new')) #redirect back to the GET app.route('warehouse/new/) to re-render the whole form again# else: flash('Store already has a warehouse') return render_template('warehouse.html', stores=Store.select())
def warehouse_create(): connected_st = Store.get_or_none( Store.store_id == request.form['store_id']) if not connected_st: flash('Selected store does not exist, please create a store first', 'danger') return redirect(url_for('warehouse_new')) new_wh = Warehouse(location=request.form['location'], store=connected_st) if new_wh.save(): flash('Warehouse Successfully created!', "success") return redirect(url_for('warehouses_list')) else: flash('Please check your internet connection and try again', 'danger') return render_template('warehouse.html')
def warehouse_create(): # print(request.form['store_id']) store = Store.get_by_id(request.form['store_id']) w = Warehouse(location=request.form['warehouse_location'], store=store) w.save() return redirect(url_for('warehouse_new'))
def warehouse_create(): w = request.form.get("w") s = request.form.get("s") wh = Warehouse(location=w, store_id=s) wh.save() return redirect(url_for("warehouse"))