def index(): items = Item.all() return render_template('items/index.html', items=items)
from models.item import Item ipad = Item( "https://www.johnlewis.com/2018-apple-ipad-pro-12-9-inch-a12x-bionic-ios-wi-fi-cellular-512gb/space-grey/p3834614", "p", {"class": "price price--large"}) ipad.save_to_mongo() # Check the item is in MongoDB # Use correct database # Find colleciton # Check item items_loaded = Item.all() print(items_loaded) print(items_loaded[0].load_price())
#ipad = Item("iPad", url, tag_name, query) bed = Item("Bed", url2, tag_name, query) chair = Item("Chair", url3, tag_name, query) washing_machine = Item("Bosch Washing Machine", url4, tag_name2, query2) sonyTV = Item("Sony TV", url5, tag_name, query) #print(f"PRICE of {ipad.item_name} = {ipad.load_price()}") print(f"PRICE of {bed.item_name} = {bed.load_price()}") print(f"PRICE of {chair.item_name} = {chair.load_price()}") print(f"PRICE of {washing_machine.item_name} = {washing_machine.load_price()}") print(f"PRICE of {sonyTV.item_name} = {sonyTV.load_price()}") # ipad.save_to_mongodb() # bed.save_to_mongodb() # chair.save_to_mongodb() items_present = Item.all() #genre = ("Python","C","C++","Java") print("Prices of Items available on MongoDB are:") for x in items_present: print(f"PRICE of {x.item_name} = {x.load_price()}") #alert_ipad = Alert("bfdcc40e66744bae985d767899fb30ff", 2000) alert_bed = Alert("b3f3bdf935a64eb0b362e9fc2d3685ba", 200) alert_chair = Alert("195d394b528944c2b1d22f4327de7054", 175) alert_washmachine = Alert("75cd56537bf44763af44917ad759e910", 500) alert_sonyTv = Alert("edbf0fc0b64a4bfbaea82436acf0e369", 1500) # alert_ipad.save_to_mongo() # alert_bed.save_to_mongo() # alert_chair.save_to_mongo()
def all_items(): items = Item.all() for item in items: item.load_price() return render_template('items/all_items.html', items=items)
def index( ): # 3rd step => 2 end points, this is first => show items (No Longer Required) items = Item.all() return render_template('items (No Longer Required)/index.html', items=items)