Exemplo n.º 1
0
class NodeSearchForm(FormPro):
    keyword = TextField()
    name = TextField(u'IP 地址')
    area = AreaSelectField(u'所属区域')
    category_id = SelectFieldPro(
        u'节点类型',
        choices=lambda: [('', u'请选择节点类型')] + [
            (unicode(r.id), r.alias) for r in Category.query.filter(
                Category.obj == "node").filter(Category.is_valid == 1)
        ])
    vendor_id = SelectFieldPro(
        u'生产厂商',
        choices=lambda: [('', u'请选择生产厂商')] + [(unicode(r.id), r.alias)
                                              for r in Vendor.query])
    model_id = SelectFieldPro(
        u'设备型号',
        choices=lambda: [('', u'请选择设备型号')] + [(unicode(r.id), r.alias)
                                              for r in Model.query])
    status = SelectFieldPro(
        u'状态', choices=lambda: [('', u'请选择状态')] + NODE_STATUS_DICT.items())

    class Meta():
        attrs = Attrs(
            label={
                'style': 'width:80px;text-align: right;padding-bottom: 10px;'
            },
            field={'style': 'padding-left: 10px;padding-bottom: 10px;'})
        list_display = ('area', 'category_id', 'vendor_id', 'model_id')
Exemplo n.º 2
0
class AreaStatisticsForm(FormPro):
    area = AreaSelectField(u'统计区域')
    query_gran = SelectFieldPro(u'统计粒度',
                                choices=[
                                    ('1', u'地市'),
                                    ('2', u'区县'),
                                    ('3', u'分局'),
                                    ('4', u'接入点'),
                                ])
Exemplo n.º 3
0
class RouterSearchForm(FormPro):
    keyword = TextField()
    area = AreaSelectField(u'所属区域')
    vendor_id = SelectFieldPro(
        u'生产厂商',
        choices=lambda: [('', u'请选择生产厂商')] + [(unicode(r.id), r.alias)
                                              for r in Vendor.query])
    model_id = SelectFieldPro(
        u'设备型号',
        choices=lambda: [('', u'请选择设备型号')] + [(unicode(r.id), r.alias)
                                              for r in Model.query])
    status = SelectFieldPro(
        u'状态', choices=lambda: [('', u'请选择状态')] + NODE_STATUS_DICT.items())