Exemple #1
0
def template_view_get(tpl_id):
    tpl_id = int(tpl_id)
    t = Template.get(tpl_id)
    if not t:
        return jsonify(msg='no such template')

    t.parent = Template.get(t.parent_id)
    ss = Strategy.select_vs(where='tpl_id = %s', params=[tpl_id], order='metric')
    t.action = Action.get(t.action_id)
    return render_template('portal/template/view.html', data={'tpl': t, 'ss': ss})
Exemple #2
0
def template_view_get(tpl_id):
    tpl_id = int(tpl_id)
    t = Template.get(tpl_id)
    if not t:
        return jsonify(msg='no such template')

    t.parent = Template.get(t.parent_id)
    ss = Strategy.select_vs(where='tpl_id = %s',
                            params=[tpl_id],
                            order='metric')
    t.action = Action.get(t.action_id)
    return render_template('portal/template/view.html',
                           data={
                               'tpl': t,
                               'ss': ss
                           })
Exemple #3
0
def template_update_get(tpl_id):
    tpl_id = int(tpl_id)
    t = Template.get(tpl_id)
    if not t:
        return jsonify(msg='no such template')

    t.parent = Template.get(t.parent_id)
    ss = Strategy.select_vs(where='tpl_id = %s',
                            params=[tpl_id],
                            order='metric')
    t.action = Action.get(t.action_id)
    log.debug(t)
    for s in ss:
        s.hook = Hook.total(where="strategy_id={id}".format(id=s.id))
    return render_template('portal/template/update.html',
                           data={
                               'tpl': t,
                               'ss': ss
                           })