def search_results(term): results = Products.query.join(Products.productUser)\ .filter(or_( Products.description.like('%'+term+'%'), ProductUser.description.like('%'+term+'%'), ProductUser.brand.like('%'+term+'%')\ ))\ .order_by(Products.upc) return json_as_configured([i.serialize() for i in results])
def file_hash(filename): u = upload() hash = u.get_hash(filename) return json_as_configured({'name':filename,'hash':hash})
def get_mem_sales(): results = Products.query.join(Products.productUser)\ .filter(Products.discounttype == 2)\ .order_by(ProductUser.brand, Products.upc) return json_as_configured([i.serialize() for i in results])
def show_item(upc): item=Products.query.get(upc.zfill(13)) return json_as_configured(item.serialize())