def lists(): pd = Product() if request.method == "GET": r = request.args page = r.get('page', 1) if page is None: page = 1 size = r.get('size', 10) if size is None: size = 10 data = pd.get_list({}, int(page), int(size)) params = get_query_url(request) return render_template('product/lists.html', products=data, url=request.path, params=params)
def product(): r = request.args pd = Product() page = r.get('page', 1) size = r.get('size', 16) if page is None: page = 1 search = r.get('search', None) if search is None: search = {} else: search = { "name": { "$regex": search } } products = pd.get_list(search, page, size) params = get_query_url(request) return render_template('plan/choose_pd.html', products=products, url=request.path, params=params)