Esempio n. 1
0
def get_rules():
    if 'sig_name' in request.args:
        search = '%%%s%%' % request.args.get('sig_name')
        rules = db.session.query(Rule, func.count(Rule.rev).label('nrevs')).\
            filter(Rule.message.like(search)).\
            group_by(Rule.sid).\
            order_by(desc(Rule.date))
    else:
        rules = db.session.query(Rule, func.count(Rule.rev).label('nrevs')).\
            group_by(Rule.sid).\
            order_by(desc(Rule.date))
    rules = alchemy_pages(rules, limit=10)
    return render_template('ui/rules.html', rules=rules, view='ui.get_rules', **request.args.to_dict())
Esempio n. 2
0
def get_rules():
    if 'sig_name' in request.args:
        search = '%%%s%%' % request.args.get('sig_name')
        rules = db.session.query(Rule, func.count(Rule.rev).label('nrevs')).\
            filter(Rule.message.like(search)).\
            group_by(Rule.sid).\
            order_by(desc(Rule.date))
    else:
        rules = db.session.query(Rule, func.count(Rule.rev).label('nrevs')).\
            group_by(Rule.sid).\
            order_by(desc(Rule.date))
    rules = alchemy_pages(rules, limit=10)
    return render_template('ui/rules.html', rules=rules, view='ui.get_rules', **request.args.to_dict())
Esempio n. 3
0
def get_rules():
    rules = db.session.query(Rule, func.count(Rule.rev).label('nrevs')).\
               group_by(Rule.sid).\
               order_by(desc(Rule.date))
    rules = alchemy_pages(rules, limit=10)
    return render_template('ui/rules.html', rules=rules, view='ui.get_rules')