def get(self): """ store.json() method call json() method in models/store.py Example: (Pdb) stores [<StoreModel 1>, <StoreModel 1>] (Pdb) stores[0] <StoreModel 1> (Pdb) stores[0].name 'bike' (Pdb) stores[0].item [<ItemModel 1>, <ItemModel 2>, <ItemModel 3>, <ItemModel 7>] (Pdb) stores[0].item[0].name 'Bajaj' (Pdb) stores[0].item[0].price 1555.5 """ stores = StoreModel.get_all_stores() return {"stores": [store.json() for store in stores]}
def get(self): return { "Stores": [store.json() for store in StoreModel.get_all_stores()] }
def get(): return StoreModel.get_all_stores()
def get(self): stores = StoreModel.get_all_stores() return {'stores': [store.json() for store in stores]}
def get(self): try: stores = [store.json() for store in StoreModel.get_all_stores()] return {'stores': stores}, 201 except Exception as e: return {'message': 'Internal server error occured {}'.format(e)}, 500