def searchdetil(self, args): criterion = set() criterion.add(Qrcode.code == args['code']) criterion.add(Qrcode.state != 3) query = db.session.query( Qrcode.id, Qrcode.names, Qrcode.bank_id, Qrcode.new_qrcode, Qrcode.receive_member, Qrcode.valid_time, Qrcode.state, Qrcode.levels, Qrcode.code, Qrcode.bank_account ).order_by(Qrcode.create_time.desc()) result = [] pagination = paginate(query, criterion) for item in pagination.items: bankname = db.session.query(BankDao.name).filter(BankDao.id == item.bank_id).first() result.append({ 'id': item.id, 'name': item.names, 'receive_member': item.receive_member, 'valid_time': item.valid_time, 'state': item.state, 'levels': item.levels, 'new_qrcode': item.new_qrcode, 'code': item.code, 'bank_account': item.bank_account, 'bankname': bankname[0], }) return result
def albums(page=1, artist_id=None): qstr = (request.args.get("q","")) if qstr: data = models.album.objects(albumtitle__icontains=qstr) breadcrumb = [['All Artists','/artists'], ['Albums', '/albums'], ["Serach for '%s'" % qstr,'/albums/artist/%s' % artist_id]] elif artist_id: data = models.album.objects(albumartist=artist_id) breadcrumb = [['All Artists','/artists'], [data[0].albumartist.albumartist,'/albums/artist/%s' % artist_id]] else: data = models.album.objects() breadcrumb = [['All Artists','/artists'], ['Albums','#']] p = models.paginate(page,10) p.total_documents = data.count() data = data[p.min:p.max] return render_template('albums.html', data=data, paginate=p, q=qstr, breadcrumb=breadcrumb)
def albums(page=1, artist_id=None): qstr = (request.args.get("q", "")) if qstr: data = models.album.objects(albumtitle__icontains=qstr) breadcrumb = [['All Artists', '/artists'], ['Albums', '/albums'], [ "Serach for '%s'" % qstr, '/albums/artist/%s' % artist_id ]] elif artist_id: data = models.album.objects(albumartist=artist_id) breadcrumb = [['All Artists', '/artists'], [ data[0].albumartist.albumartist, '/albums/artist/%s' % artist_id ]] else: data = models.album.objects() breadcrumb = [['All Artists', '/artists'], ['Albums', '#']] p = models.paginate(page, 10) p.total_documents = data.count() data = data[p.min:p.max] return render_template('albums.html', data=data, paginate=p, q=qstr, breadcrumb=breadcrumb)
def searchall(self, page, pageSize): criterion = set() criterion.add(Qrcode.bank_id == BankDao.id) criterion.add(Qrcode.state != 3) query = db.session.query( Qrcode.id, Qrcode.names, Qrcode.bank_id, Qrcode.bank_account, Qrcode.receive_member, Qrcode.valid_time, Qrcode.state, Qrcode.levels, Qrcode.code, BankDao.name ).order_by(Qrcode.create_time.desc()) result = [] pagination = paginate(query,criterion, page, pageSize) for item in pagination.items: result.append({ 'id': item.id, 'name': item.names, 'bankname': item.name, 'bank_account': item.bank_account, 'receive_member': item.receive_member, 'valid_time': item.valid_time, 'state': item.state, 'levels': item.levels, 'code': item.code, 'isshowlevel': False }) return make_response(result, page=pagination.page, pages=pagination.pages, total=pagination.total)
def searchdetails(self, args): query = db.session.query( DfAgentRate.mer_username, DfAgentRate.rate_amount, DfAgentRate.rate_prop, ).filter(MerchantDao.code == args['agent_code'], DfAgentRate.agent_code == args['agent_code']) pagination = paginate(query) return pagination
def artists(page=1): qstr = (request.args.get("q","")) if qstr: data = models.artist.objects(albumartist__icontains=qstr) else: data = models.artist.objects().order_by('albumartist') p = models.paginate(page,10) p.total_documents = data.count() data = data[p.min:p.max] return render_template('artists.html', data=data, paginate=p, q=qstr)
def artists(page=1): qstr = (request.args.get("q", "")) if qstr: data = models.artist.objects(albumartist__icontains=qstr) else: data = models.artist.objects().order_by('albumartist') p = models.paginate(page, 10) p.total_documents = data.count() data = data[p.min:p.max] return render_template('artists.html', data=data, paginate=p, q=qstr)
def get_data(critern=None,page=None,per_page=None): query = db.session.query( BankTradeDao.id, BankTradeDao.order_no, BankTradeDao.amount, BankTradeDao.action_time, BankTradeDao.pay_time, BankTradeDao.qr_code, BankTradeDao.state, BankTradeDao.audit_time, ).order_by(desc(BankTradeDao.action_time)) res = paginate(query,critern,page,per_page) return res
def Criteria_query(self,args): criterion = set() criterion.add(Qrcode.state != 3) if args['state'] is not None: criterion.add(Qrcode.state == args['state']) if args['selectPayType'] is not None: criterion.add(Qrcode.ori_type.in_(args['selectPayType'].split(','))) if args['name'] is not None: criterion.add(Qrcode.names == args['name']) if args['bank_account'] is not None: criterion.add(Qrcode.bank_account == args['bank_account']) query = db.session.query( Qrcode.id, Qrcode.names, Qrcode.bank_id, Qrcode.bank_account, Qrcode.receive_member, Qrcode.valid_time, Qrcode.state, Qrcode.levels, Qrcode.code ).order_by(Qrcode.create_time.desc()) result = [] pagination = paginate(query, criterion, args['page'], args['page_size']) for item in pagination.items: if item.state != 3: bankname = db.session.query(BankDao.name).filter(BankDao.id == item.bank_id).first() result.append({ 'id': item.id, 'name': item.names, 'bankname': bankname, 'bank_account': item.bank_account, 'receive_member': item.receive_member, 'valid_time': item.valid_time, 'state': item.state, 'levels': item.levels, 'code': item.code, 'isshowlevel': False }) return make_response(result, page=pagination.page, pages=pagination.pages, total=pagination.total)
def songs(page=1, album_id=""): qstr = (request.args.get("q", "")) if qstr: data = models.song.objects(songtitle__icontains=qstr) breadcrumb = [['All Artists', '/artists'], ['Albums', '/albums'], ['Songs', '/songs'], ["Serach for '%s'" % qstr, '']] elif album_id: data = models.song.objects(album=album_id).order_by('tracknumber') breadcrumb = [['All Artists', '/artists'], [ data[0].artist, '/albums/artist/%s' % data[0].albumartist.id ], [data[0].album.albumtitle, '#']] else: data = models.song.objects() breadcrumb = [['Artists', '/artists'], ['Albums', '/albums'], ['Songs', '#']] p = models.paginate(page, 10) p.total_documents = data.count() data = data[p.min:p.max] try: #mb = models.musicbrainz(data[0].album) album = data[0].album cover_url = album.get_coverart_url() cover_url = "/static/media/%s" % (cover_url) except Exception as e: cover_url = "/static/img/generic_album_cover.jpg" return render_template('songs.html', data=data, paginate=p, q=qstr, url=cover_url, breadcrumb=breadcrumb)
def songs(page=1, album_id=""): qstr = (request.args.get("q","")) if qstr: data = models.song.objects(songtitle__icontains=qstr) breadcrumb = [['All Artists','/artists'], ['Albums', '/albums'], ['Songs', '/songs'], ["Serach for '%s'" % qstr,'']] elif album_id: data = models.song.objects(album=album_id).order_by('tracknumber') breadcrumb = [ ['All Artists','/artists'], [data[0].artist,'/albums/artist/%s' % data[0].albumartist.id], [data[0].album.albumtitle,'#'] ] else: data = models.song.objects() breadcrumb = [ ['Artists','/artists'], ['Albums','/albums'], ['Songs','#']] p = models.paginate(page,10) p.total_documents = data.count() data = data[p.min:p.max] try: #mb = models.musicbrainz(data[0].album) album = data[0].album cover_url = album.get_coverart_url() cover_url = "/static/media/%s" % (cover_url) except Exception as e: cover_url = "/static/img/generic_album_cover.jpg" return render_template('songs.html', data=data, paginate=p, q=qstr, url=cover_url, breadcrumb=breadcrumb)
def get(self, id=None): parser = RequestParser(trim=True) parser.add_argument('amount_lower', type=int) parser.add_argument('amount_upper', type=int) parser.add_argument('begin_time', type=int) parser.add_argument('end_time', type=int) parser.add_argument('begin_audit_time', type=int) parser.add_argument('end_audit_time', type=int) parser.add_argument('qr_code', type=str) parser.add_argument('state', type=int) parser.add_argument('page', type=int, default=DEFAULT_PAGE) parser.add_argument('page_size', type=int, default=DEFAULT_PAGE_SIZE) args = parser.parse_args(strict=True) critern = set() if id is not None: critern.add(BankTradeDao.id == id) if args['amount_lower'] is not None: critern.add(BankTradeDao.amount >= args['amount_lower']) if args['amount_upper'] is not None: critern.add(BankTradeDao.amount <= args['amount_upper']) if args['begin_time'] is not None: critern.add(BankTradeDao.pay_time >= args['pay_time']) if args['end_time'] is not None: critern.add(BankTradeDao.pay_time <= args['pay_time']) if args['qr_code'] is not None: critern.add(BankTradeDao.qr_code == args['qr_code']) if args['state'] is not None: critern.add(BankTradeDao.state == args['state']) if args['begin_audit_time'] is not None: critern.add(BankTradeDao.audit_time >= args['begin_audit_time']) if args['end_audit_time'] is not None: critern.add(BankTradeDao.audit_time <= args['end_audit_time']) query = db.session.query(BankTradeDao).order_by( desc(BankTradeDao.action_time)) pagination = paginate(query, critern, args['page'], args['page_size']) return make_response_from_pagination(pagination)
def usuario_listar_view(page): usuarios = Usuario.query.order_by('nome ASC').all() res = paginate(usuarios, page, Usuario, 8) return render_template('adm/usuario/listar.html', active_page='adm', user=login.current_user, **res)
def perfil_listar_view(page): perfis = Perfil.query.order_by('nome ASC').all() res = paginate(perfis, page, Perfil, 8) return render_template('adm/perfil/listar.html', active_page='adm', user=login.current_user, **res)
def funcionalidade_listar_view(page): funcionalidades = Funcionalidade.query.order_by('nome ASC').all() res = paginate(funcionalidades, page, Funcionalidade, 8) return render_template('adm/funcionalidade/listar.html', active_page='adm', user=login.current_user, **res)
def acao_listar_view(page): acoes = Acao.query.order_by('perfil_id ASC').all() res = paginate(acoes, page, Acao, 8) return render_template('adm/acao/listar.html', active_page='adm', user=login.current_user, **res)