def create_product(): name = request.form['name'] description = request.form['description'] stock_quantity = request.form['stock_quantity'] buying_cost = request.form['buying_cost'] selling_price = request.form['selling_cost'] manufacturer_id = request.form["manufacturer_id"] manufacturer = manufacturer_repository.select(manufacturer_id) product = Product(name, description, stock_quantity, buying_cost, selling_price, manufacturer) product_repository.save(product) return redirect('/products')
def create_product(): model = request.form["model"] description = request.form["description"] colour = request.form["colour"] buy_price = request.form["buy_price"] sell_price = request.form["sell_price"] quantity = request.form["quantity"] manufacturer = request.form["manufacturer_id"] new_product = Product(model, description, colour, buy_price, sell_price, quantity, manufacturer) product_repository.save(new_product) return redirect("/products")
def create_product(): name = request.form['name'] description = request.form['description'] stock = request.form['stock'] buy_price = request.form['buy_price'] sell_price = request.form['sell_price'] manufacturer = manufacturer_repository.select( request.form['manufacturer_id']) product = Product(name, description, stock, buy_price, sell_price, manufacturer) # print("marco 34hy5") product_repository.save(product) return redirect('/products')
def create_product(): record_label_id = request.form['record_label_id'] title = request.form['title'] artist = request.form['artist'] record_label = record_label_repository.select(record_label_id) format = request.form['format'] genre = request.form['genre'] quantity = request.form['quantity'] buy_cost = request.form['buy_cost'] sell_price = request.form['sell_price'] product = Product(title, artist, record_label, format, genre, quantity, buy_cost, sell_price) product_repository.save(product) return redirect("/products")
def create_product(): name = request.form["name"] description = request.form["description"] stock_quantity = request.form["stock_quantity"] buying_cost = request.form["buying_cost"] selling_price = request.form["selling_price"] category = request.form["category"] manufacturer_id = request.form["manufacturer_id"] manufacturer = manufacturer_repository.select(manufacturer_id) product = Product(name, description, stock_quantity, buying_cost, selling_price, category, manufacturer) product_repository.save(product) return redirect('/products')
def create_product(): name = request.form["name"] category = request.form["category"] in_stock = request.form["in_stock"] cost_price = request.form["cost_price"] mark_up = request.form["mark_up"] description = request.form["description"] minimum_stock_level = request.form["minimum_stock_level"] supplier = supplier_repository.select(request.form['supplier_id']) sale_price = Product.set_markup(cost_price, mark_up) new_product = Product(name, category, in_stock, cost_price, mark_up, sale_price, description, minimum_stock_level, supplier) product_repository.save(new_product) return redirect("/products")
def create_a_product(): product_type = product_type_repository.select(request.form["type_choice"]) product_brand = brand_repository.select(request.form["brand_choice"]) new_product = Product( request.form["newProductName"], product_type, product_brand, request.form["newProductDescription"], request.form["newProductDistPrice"], request.form["newProductSalePrice"], request.form["newProductWarrantyLength"], ) product_repository.save(new_product) new_stock_item = Stock(new_product) stock_repository.save(new_stock_item) return redirect("/fullview")
def setup_products(): product_1_name = "ED209" product_1_description = "Not great on stairs" product_1_distributor_price = 200 product_1_sale_price = 600 product_1_warranty_length = 120 global product_1 product_1 = Product( product_1_name, product_type_1, brand1, product_1_description, product_1_distributor_price, product_1_sale_price, product_1_warranty_length, ) product_2_name = "dezapper" product_2_description = "It will zapp you into the past" product_2_distributor_price = 300 product_2_sale_price = 700 product_2_warranty_length = 140 global product_2 product_2 = Product( product_2_name, product_type_1, brand1, product_2_description, product_2_distributor_price, product_2_sale_price, product_2_warranty_length, ) global product_3 product_3 = Product( product_2_name, product_type_3, brand2, product_2_description, 130, 500, 300 ) global product_4 product_4 = Product( product_2_name, product_type_4, brand2, product_2_description, 140, 360, 150 ) product_repository.save(product_1) product_repository.save(product_2) product_repository.save(product_3) product_repository.save(product_4)
product_repository.delete_all() supplier_repository.delete_all() supplier1 = Supplier("Timothy Taylors", "Knowle Spring Brewery, Keighley", "01535-555-555", "Landlord") supplier_repository.save(supplier1) supplier2 = Supplier("ABV Wholesale", "Dalton Lane, Keighley", "01535-699-699", "Budvar") supplier_repository.save(supplier2) supplier3 = Supplier("Premier Cru", "Ballpark Road, Shipley", "01274-545-667", "Chenin Blanc") supplier_repository.save(supplier3) supplier_repository.select_all() product1 = Product("Landlord", "Draught", 12, 1.23, 70, 2.09, "A Strong Pale Ale", 36, supplier1) product_repository.save(product1) product2 = Product("Budvar", "Bottles", 24, 2.20, 70, 3.74, "A Czech Pilsner", 24, supplier2) product_repository.save(product2) product3 = Product("Chenin Blanc", "Wine", 12, 9.50, 70, 16.15, "Crisp French White Wine", 12, supplier3) product_repository.save(product3) pdb.set_trace()
import repositories.product_repository as product_repository import repositories.record_label_repository as record_label_repository product_repository.delete_all() record_label_repository.delete_all() record_label1 = RecordLabel("Castleface Records", "San Francisco, CA") record_label_repository.save(record_label1) record_label2 = RecordLabel("Melted Ice Cream Records", "Christchurch, NZ") record_label_repository.save(record_label2) record_label3 = RecordLabel("Flying Nun Records", "Christchurch, NZ") record_label_repository.save(record_label3) product1 = Product("Lifetime of Secretion", "Dance Asthmatics", record_label2, "Cassette", "Post-Punk", 15, 8.50, 19.99) product_repository.save(product1) product2 = Product("Castlemania", "Thee Oh Sees", record_label1, "LP", "Psychedelic", 25, 9.50, 21.99) product_repository.save(product2) product3 = Product("Metalmania", "Salad Boys", record_label2, "CD", "Jangle-Psych", 35, 8.50, 15.99) product_repository.save(product3) product4 = Product("Screens", "The Mint Chicks", record_label3, "LP", "Post-Punk", 7, 12.50, 23.99) product_repository.save(product4) product5 = Product("Meat Prize", "Team Ugly", record_label2, "Cassette", "Slop-Rock", 10, 5.50, 9.99)
import repositories.manufacturer_repository as manufacturer_repository manufacturer_repository.delete_all() product_repository.delete_all() manufacturer_1 = Manufacturer("Apple", "USA") manufacturer_repository.save(manufacturer_1) manufacturer_2 = Manufacturer("Samsung", "South Korea") manufacturer_repository.save(manufacturer_2) manufacturer_3 = Manufacturer("Google", "USA") manufacturer_repository.save(manufacturer_3) product_1 = Product("iPhone 11", "6.1 inches", "Black", 679.00, 779.00, 60, manufacturer_1.id) product_repository.save(product_1) product_2 = Product("iPhone X", "6.1 inches", "Space Grey", 379.00, 479.00, 70, manufacturer_1.id) product_repository.save(product_2) product_3 = Product("Galaxy S20", "6.2 inches", "Cloud Navy", 550.00, 799.00, 100, manufacturer_2.id) product_repository.save(product_3) product_4 = Product("Galaxy S10", "6.1 inches", "Ceramic Black", 450.00, 600.00, 30, manufacturer_2.id) product_repository.save(product_4) product_5 = Product("Pixel 5", "6.0 inches", "Sorta Sage", 499.00, 599.00, 20, manufacturer_3.id) product_repository.save(product_5) product_6 = Product("Pixel 4", "6.2 inches", "Just Black", 299.00, 349.00, 40, manufacturer_3.id) product_repository.save(product_6)