def templates_get(): page = int(request.args.get('p', 1)) limit = int(request.args.get('limit', 10)) query = request.args.get('q', '').strip() mine = request.args.get('mine', '1') me = g.user.name if mine == '1' else None vs, total = Template.query(page, limit, query, me) for v in vs: v.parent = Template.get(v.parent_id) return render_template('portal/template/list.html', data={ 'vs': vs, 'total': total, 'query': query, 'limit': limit, 'page': page, 'mine': mine, })
def templates_get(): page = int(request.args.get('p', 1)) limit = int(request.args.get('limit', 10)) query = request.args.get('q', '').strip() mine = request.args.get('mine', '1') me = g.user.name if mine == '1' else None vs, total = Template.query(page, limit, query, me) for v in vs: v.parent = Template.get(v.parent_id) return render_template( 'portal/template/list.html', data={ 'vs': vs, 'total': total, 'query': query, 'limit': limit, 'page': page, 'mine': mine, } )
def api_template_query(): q = request.args.get('query', '').strip() limit = int(request.args.get('limit', '10')) ts, _ = Template.query(1, limit, q) ts = [t.to_json() for t in ts] return jsonify(data=ts)
def api_template_query(): q = request.args.get('query', '').strip() limit = int(request.args.get('limit', '10')) ts, _ = Template.query(1, limit, q) ts = [t.to_json() for t in ts] return jsonify(data=ts)