Example #1
0
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])
Example #2
0
def file_hash(filename):
	u = upload()
	hash = u.get_hash(filename)
	return json_as_configured({'name':filename,'hash':hash})
Example #3
0
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])
Example #4
0
def show_item(upc):
	item=Products.query.get(upc.zfill(13))
	return json_as_configured(item.serialize())