• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python models.TableField类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中steelscript.appfwk.apps.datasource.models.TableField的典型用法代码示例。如果您正苦于以下问题:Python TableField类的具体用法?Python TableField怎么用?Python TableField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TableField类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: post_process_table

    def post_process_table(self, field_options):
        super(NetProfilerTrafficTimeSeriesTable, self).post_process_table(
            field_options)

        if self.options.top_n is None:
            # If not top-n, the criteria field 'query_columns' must
            # either be a string or an array of column definitions
            # (a string is simply parsed as json to the latter).
            #
            # This criteria field must resolve to an array of
            # field definitions, one per column to be queried
            #
            # An array of column defintions looks like the following:
            #   [ {'name': <name>, 'label': <name>, 'json': <json>},
            #     {'name': <name>, 'label': <name>, 'json': <json>},
            #     ... ]
            #
            # Each element corresponds to a column requested.  <name> is
            # used as the Column.name, <label> is for the Column.label
            # and json is what is passed on to NetProfiler in the POST
            # to create the report
            #
            TableField.create(keyword='query_columns',
                              label='Query columns',
                              obj=self)
开发者ID:carriercomm,项目名称:steelscript-netprofiler,代码行数:25,代码来源:netprofiler.py


示例2: fields_add_filemgr_selection

def fields_add_filemgr_selection(obj,
                                 keyword='filemgrfile',
                                 label='FileMgrFile'):
    field = TableField(keyword=keyword, label=label,
                       field_cls=IntegerIDChoiceField,
                       pre_process_func=Function(file_selection_preprocess))
    field.save()
    obj.fields.add(field)
开发者ID:riverbed,项目名称:steelscript-appfwk,代码行数:8,代码来源:forms.py


示例3: add_netprofiler_application_field

def add_netprofiler_application_field(report, section, app=None):
    """ Attach fields for dynamic Application dropdowns to add as filter
    expressions to the report.

    This can be added for each section in a report where the added filter
    expression is desired.

    The optional ``app`` argument can be either a single string or a list
    of strings for each HostGroupType.  If a single string, the
    'Application' field will be hidden and automatically filter Applications
    to the given App.  If a list, the elements of the App
    list will be fixed to those in the list.
    """
    # add default filter expr to extend against
    filterexpr = TableField.create(keyword='netprofiler_filterexpr')
    section.fields.add(filterexpr)

    if app is None:
        # use all available apps
        field = TableField.create(
            keyword='application',
            label='Application',
            obj=report,
            field_cls=forms.ChoiceField,
            field_kwargs={'widget_attrs': {'class': 'form-control'}},
            parent_keywords=['netprofiler_device'],
            dynamic=True,
            pre_process_func=Function(netprofiler_application_choices)
        )
        section.fields.add(field)

    elif type(app) in (list, tuple):
        # add apps field that uses given list
        field = TableField.create(
            keyword='application',
            label='Application',
            obj=report,
            field_cls=forms.ChoiceField,
            field_kwargs={'choices': zip(app, app),
                          'widget_attrs': {'class': 'form-control'}},
            parent_keywords=['netprofiler_device'],
        )
        section.fields.add(field)

    else:
        # no app, so no field just hardcode the filter
        NetProfilerTable.extend_filterexpr(
            section, keyword='application',
            template='app {}'.format(app)
        )

        # we're done here
        return

    NetProfilerTable.extend_filterexpr(
        section, keyword='hg_filterexpr',
        template='app {application}'
    )
开发者ID:riverbed,项目名称:steelscript-netprofiler,代码行数:58,代码来源:netprofiler.py


示例4: fields_add_stock_symbol

 def fields_add_stock_symbol(self, help_text, keyword='stock_symbol',
                             initial=None):
     field = TableField(keyword=keyword,
                        label='Stock Symbol',
                        help_text=(help_text),
                        initial=initial,
                        required=True)
     field.save()
     self.fields.add(field)
开发者ID:riverbed,项目名称:steelscript-stock,代码行数:9,代码来源:stock_source.py


示例5: fields_add_filterexpr

 def fields_add_filterexpr(self, keyword='netshark_filterexpr', initial=None):
     field = TableField(keyword=keyword,
                        label='NetShark Filter Expression',
                        help_text='Traffic expression using '
                                  'NetShark filter syntax',
                        initial=initial,
                        required=False)
     field.save()
     self.fields.add(field)
开发者ID:jr69ss,项目名称:steelscript-netshark,代码行数:9,代码来源:netshark.py


示例6: fields_add_filterexpr

 def fields_add_filterexpr(self, keyword='netprofiler_filterexpr',
                           initial=None):
     field = TableField(keyword=keyword,
                        label='NetProfiler Filter Expression',
                        help_text=('Traffic expression using NetProfiler '
                                   'Advanced Traffic Expression syntax'),
                        initial=initial,
                        required=False)
     field.save()
     self.fields.add(field)
开发者ID:carriercomm,项目名称:steelscript-netprofiler,代码行数:10,代码来源:netprofiler.py


示例7: fields_add_device_selection

def fields_add_device_selection(obj, keyword='device',
                                label='Device',
                                module=None, enabled=None):
    field = TableField(keyword=keyword, label=label,
                       field_cls=IntegerIDChoiceField,
                       pre_process_func=Function(device_selection_preprocess,
                                                 {'module': module,
                                                  'enabled': enabled}))
    field.save()
    obj.fields.add(field)
开发者ID:riverbed,项目名称:steelscript-appfwk,代码行数:10,代码来源:forms.py


示例8: post_process_table

    def post_process_table(self, field_options):
        super(SCCThroughputTable, self).post_process_table(field_options)

        # Add device ID field
        field = TableField(keyword='device',
                           label='Device Serial ID',
                           required=True)
        field.save()
        self.fields.add(field)

        # Add port field
        field = TableField(keyword='port',
                           label='Port',
                           required=False)
        field.save()
        self.fields.add(field)

        # Add traffic_type field
        traffic_types = ('peak', 'p95')
        field = TableField(keyword='traffic_type',
                           label='Traffic Type',
                           field_cls=forms.ChoiceField,
                           field_kwargs={'choices':
                                         zip(traffic_types, traffic_types)})
        field.save()
        self.fields.add(field)
开发者ID:carriercomm,项目名称:steelscript-scc,代码行数:26,代码来源:scc.py


示例9: fields_add_time_selection

def fields_add_time_selection(obj, show_duration=True, initial_duration=None,
                              durations=None,
                              show_start=False,
                              initial_start_time='now-1h',
                              initial_start_date='now-1h',
                              show_end=True,
                              initial_end_time='now-0',
                              initial_end_date='now-0',
                              round_initial=0,  # seconds to round initial time
                              special_values=None):

    if show_start:
        field = TableField(keyword='starttime',
                           label='Start Time',
                           field_cls=DateTimeField,
                           field_kwargs={
                               'widget': ReportSplitDateTimeWidget,
                               'widget_attrs': {
                                   'initial_time': initial_start_time,
                                   'initial_date': initial_start_date,
                                   'round_initial': round_initial
                               }
                           },
                           required=False)
        field.save()
        obj.fields.add(field)

    if show_end:
        field = TableField(keyword='endtime',
                           label='End Time',
                           field_cls=DateTimeField,
                           field_kwargs={
                               'widget': ReportSplitDateTimeWidget,
                               'widget_attrs': {
                                   'initial_time': initial_end_time,
                                   'initial_date': initial_end_date,
                                   'round_initial': round_initial
                               }
                           },
                           required=False)
        field.save()
        obj.fields.add(field)

    if show_duration:
        if durations is None:
            durations = DURATIONS

        field = TableField(keyword='duration',
                           label='Duration',
                           initial=initial_duration,
                           field_cls=DurationField,
                           field_kwargs={'choices': durations,
                                         'special_values': special_values},
                           required=False)
        field.save()
        obj.fields.add(field)
开发者ID:riverbed,项目名称:steelscript-appfwk,代码行数:56,代码来源:forms.py


示例10: fields_add_end_date

 def fields_add_end_date(self, initial_end_date='now-0'):
     # Add a date field
     # the front javascript code will determine the default date
     # according to initial_end_date, so if initial_end_date is
     # 'now-0', today will be the default end date
     field = TableField(keyword='end_date',
                        label='End Date',
                        field_cls=DateTimeField,
                        field_kwargs={'widget': ReportSplitDateWidget,
                                      'widget_attrs': {'initial_date':
                                                       initial_end_date}},
                        required=False)
     field.save()
     self.fields.add(field)
开发者ID:riverbed,项目名称:steelscript-stock,代码行数:14,代码来源:stock_source.py


示例11: extend_filterexpr

    def extend_filterexpr(cls, obj, keyword, template):

        field = obj.fields.get(keyword='netprofiler_filterexpr')
        field.post_process_func = Function(
            function=_post_process_combine_filterexprs
        )

        TableField.create(
            keyword=keyword, obj=obj, hidden=True,
            post_process_template=template)

        parent_keywords = set(field.parent_keywords or [])
        parent_keywords.add(keyword)
        field.parent_keywords = list(parent_keywords)
        field.save()
开发者ID:carriercomm,项目名称:steelscript-netprofiler,代码行数:15,代码来源:netprofiler.py


示例12: fields_add_resolution

def fields_add_resolution(obj, initial=None,
                          resolutions=None,
                          special_values=None):

    if resolutions is None:
        resolutions = ('1m', '15m', '1h', '6h')

    field = TableField(keyword='resolution',
                       label='Data Resolution',
                       field_cls=DurationField,
                       field_kwargs={'choices': resolutions,
                                     'special_values': special_values},
                       initial=initial)
    field.save()
    obj.fields.add(field)
开发者ID:riverbed,项目名称:steelscript-appfwk,代码行数:15,代码来源:forms.py


示例13: __init__

    def __init__(self, *args, **kwargs):
        fields = {}

        res = TableField.objects.filter(keyword='batch_file')

        if not res:
            file_upload = TableField(keyword='batch_file',
                                     label='Batch File',
                                     field_cls=FileSelectField,
                                     field_kwargs=dict(widget=FileInput),
                                     required=True)
            file_upload.save()
        else:
            file_upload = res[0]

        fields['batch_file'] = file_upload

        super(DeviceBatchForm, self).__init__(fields, *args, **kwargs)
开发者ID:riverbed,项目名称:steelscript-appfwk,代码行数:18,代码来源:forms.py


示例14: post_process_table

    def post_process_table(self, field_options):
        #
        # Add criteria fields that are required by this table
        #
        TableField.create(keyword='entire_pcap', obj=self,
                          field_cls=forms.BooleanField,
                          label='Entire PCAP',
                          initial=True,
                          required=False)

        fields_add_time_selection(self, show_start=True, show_end=True,
                                  show_duration=False)
        fields_add_resolution(obj=self,
                              initial=field_options['resolution'],
                              resolutions=field_options['resolutions'])
        fields_add_pcapfile(
            obj=self, astextfield=field_options['pcapfile_astextfield'])
        fields_add_filterexpr(obj=self)
开发者ID:jr69ss,项目名称:steelscript-wireshark,代码行数:18,代码来源:wireshark_source.py


示例15: fields_add_pcapfile

def fields_add_pcapfile(obj, keyword='pcapfilename',
                        label='PCAP File', initial=None,
                        astextfield=False):
    """Add a PCAP file selection field.

    :param bool astextfield: If True, use a text field instead of a
        file selection field.  The text value is interpreted as
        a file on the server.

    """

    kwargs = {}
    if not astextfield:
        kwargs['field_cls'] = FileSelectField
        kwargs['field_kwargs'] = {'widget': FileInput}

    field = TableField(keyword=keyword,
                       label=label,
                       **kwargs)
    field.save()
    obj.fields.add(field)
开发者ID:jr69ss,项目名称:steelscript-wireshark,代码行数:21,代码来源:wireshark_source.py


示例16: post_process_table

    def post_process_table(self, field_options):
        duration = field_options['duration']
        if isinstance(duration, int):
            duration = "{}m".format(duration)

        fields_add_device_selection(self, keyword='netshark_device',
                                    label='NetShark', module='netshark',
                                    enabled=True)

        func = Function(netshark_msa_file_choices,
                        self.options)
        TableField.create(keyword='netshark_source_name', label='Source',
                          obj=self,
                          field_cls=IDChoiceField,
                          field_kwargs={
                              'widget_attrs': {'class': 'form-control'}
                          },
                          parent_keywords=['netshark_device'],
                          dynamic=True,
                          pre_process_func=func)

        fields_add_time_selection(self,
                                  initial_duration=duration,
                                  durations=field_options['durations'])
        fields_add_resolution(self,
                              initial=field_options['resolution'],
                              resolutions=field_options['resolutions'])

        if self.options.include_filter:
            fields_add_filterexpr(self)

        if self.options.include_bpf_filter:
            fields_add_bpf_filterexpr(self)

        if self.options.show_entire_msa:
            TableField.create(keyword='entire_msa', obj=self,
                              field_cls=forms.BooleanField,
                              label='Entire MSA (ignore start/end times)',
                              initial=True,
                              required=False)
开发者ID:riverbed,项目名称:steelscript-netshark,代码行数:40,代码来源:netshark_msa.py


示例17: post_process_table

    def post_process_table(self, field_options):
        duration = field_options['duration']
        if isinstance(duration, int):
            duration = "%dm" % duration

        fields_add_device_selection(self, keyword='netshark_device',
                                    label='NetShark', module='netshark',
                                    enabled=True)

        func = Function(netshark_source_name_choices,
                        self.options)
        TableField.create(
            keyword='netshark_source_name', label='Source',
            obj=self,
            field_cls=IDChoiceField,
            field_kwargs={'widget_attrs': {'class': 'form-control'}},
            parent_keywords=['netshark_device'],
            dynamic=True,
            pre_process_func=func
        )

        if self.options.include_persistent:
            TableField.create(keyword='netshark_persistent',
                              label='Persistent View', obj=self,
                              field_cls=forms.BooleanField,
                              initial=False)

        fields_add_time_selection(self,
                                  initial_duration=duration,
                                  durations=field_options['durations'])
        fields_add_resolution(self,
                              initial=field_options['resolution'],
                              resolutions=field_options['resolutions'])

        if self.options.include_filter:
            fields_add_filterexpr(self)

        if self.options.include_bpf_filter:
            fields_add_bpf_filterexpr(self)
开发者ID:riverbed,项目名称:steelscript-netshark,代码行数:39,代码来源:netshark.py


示例18: post_process_table

    def post_process_table(self, field_options):
        duration = field_options['duration']
        if isinstance(duration, int):
            duration = "%dm" % duration

        fields_add_device_selection(self, keyword='netshark_device',
                                    label='NetShark', module='netshark',
                                    enabled=True)

        TableField.create(keyword='netshark_source_name', label='Source',
                          obj=self,
                          field_cls=forms.ChoiceField,
                          parent_keywords=['netshark_device'],
                          dynamic=True,
                          pre_process_func=Function(netshark_source_name_choices))

        fields_add_time_selection(self,
                                  initial_duration=duration,
                                  durations=field_options['durations'])
        fields_add_resolution(self,
                              initial=field_options['resolution'],
                              resolutions=field_options['resolutions'])
        self.fields_add_filterexpr()
开发者ID:jr69ss,项目名称:steelscript-netshark,代码行数:23,代码来源:netshark.py


示例19: post_process_table

    def post_process_table(self, field_options):
        fields_add_device_selection(self, keyword='netprofiler_device',
                                    label='NetProfiler', module='netprofiler',
                                    enabled=True)
        fields_add_time_selection(self, show_end=True, show_duration=False)

        func = Function(netprofiler_live_templates, self.options)

        TableField.create('template_id', label='Template',
                          obj=self,
                          field_cls=IDChoiceField,
                          parent_keywords=['netprofiler_device'],
                          dynamic=True,
                          pre_process_func=func)

        self.add_column('template_id', 'Template ID', datatype='string',
                        iskey=True)
        self.add_column('widget_id', 'Widget ID', datatype='integer',
                        iskey=True)
        self.add_column('title', 'Title', datatype='string')
        self.add_column('widget_type', 'Type', datatype='string')
        self.add_column('visualization', 'Visualization', datatype='string')
        self.add_column('datasource', 'Data Source', datatype='string')
开发者ID:riverbed,项目名称:steelscript-netprofiler,代码行数:23,代码来源:netprofiler_live.py


示例20:

from django import forms

from steelscript.appfwk.apps.datasource.modules.analysis import CriteriaTable
from steelscript.appfwk.apps.datasource.models import TableField

from steelscript.appfwk.apps.report.models import Report
from steelscript.appfwk.apps.report.modules import raw

report = Report.create(title='Criteria Bool')

# Section
section = report.add_section(title='Section 0')

# Table
a = CriteriaTable.create('test-criteria-bool')

# Table-level criteria
TableField.create('b1', 'Bool True', obj=a,
                  field_cls=forms.BooleanField, initial=True)
TableField.create('b2', 'Bool False', obj=a,
                  field_cls=forms.BooleanField, initial=False)

report.add_widget(raw.TableWidget, a, 'Table')
开发者ID:carriercomm,项目名称:steelscript-appfwk,代码行数:23,代码来源:criteria_bool.py



注:本文中的steelscript.appfwk.apps.datasource.models.TableField类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python devicemanager.DeviceManager类代码示例发布时间:2022-05-27
下一篇:
Python stdwin.fleep函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap