コード例 #1
0
 def get(self, category):
     collection = mongo.db.products
     categories = get_categories(collection)
     product_details = mongo.db.products.find({"category": category})
     return render_template('/products/details.html',
                            products=product_details,
                            categories=categories)
コード例 #2
0
 def get(self):
     collection = mongo.db.products
     categories = get_categories(collection)
     low_quantity_items = get_quantities_below_five(mongo)
     return render_template('/products/index.html',
                            categories=categories,
                            products=low_quantity_items)
コード例 #3
0
 def get(self, product):
     collection = mongo.db.products
     searched_product = collection.find({"name":
                                        {'$regex': product,
                                         '$options': "xi"}})
     categories = get_categories(collection)
     return render_template('/products/search.html',
                            products=searched_product,
                            categories=categories)