当前位置: 首页>>代码示例>>Python>>正文


Python TableField.save方法代码示例

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


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

示例1: fields_add_filemgr_selection

# 需要导入模块: from steelscript.appfwk.apps.datasource.models import TableField [as 别名]
# 或者: from steelscript.appfwk.apps.datasource.models.TableField import save [as 别名]
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,代码行数:10,代码来源:forms.py

示例2: fields_add_filterexpr

# 需要导入模块: from steelscript.appfwk.apps.datasource.models import TableField [as 别名]
# 或者: from steelscript.appfwk.apps.datasource.models.TableField import save [as 别名]
 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,代码行数:11,代码来源:netshark.py

示例3: fields_add_stock_symbol

# 需要导入模块: from steelscript.appfwk.apps.datasource.models import TableField [as 别名]
# 或者: from steelscript.appfwk.apps.datasource.models.TableField import save [as 别名]
 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,代码行数:11,代码来源:stock_source.py

示例4: fields_add_device_selection

# 需要导入模块: from steelscript.appfwk.apps.datasource.models import TableField [as 别名]
# 或者: from steelscript.appfwk.apps.datasource.models.TableField import save [as 别名]
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,代码行数:12,代码来源:forms.py

示例5: fields_add_filterexpr

# 需要导入模块: from steelscript.appfwk.apps.datasource.models import TableField [as 别名]
# 或者: from steelscript.appfwk.apps.datasource.models.TableField import save [as 别名]
 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,代码行数:12,代码来源:netprofiler.py

示例6: fields_add_end_date

# 需要导入模块: from steelscript.appfwk.apps.datasource.models import TableField [as 别名]
# 或者: from steelscript.appfwk.apps.datasource.models.TableField import save [as 别名]
 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,代码行数:16,代码来源:stock_source.py

示例7: fields_add_resolution

# 需要导入模块: from steelscript.appfwk.apps.datasource.models import TableField [as 别名]
# 或者: from steelscript.appfwk.apps.datasource.models.TableField import save [as 别名]
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,代码行数:17,代码来源:forms.py

示例8: __init__

# 需要导入模块: from steelscript.appfwk.apps.datasource.models import TableField [as 别名]
# 或者: from steelscript.appfwk.apps.datasource.models.TableField import save [as 别名]
    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,代码行数:20,代码来源:forms.py

示例9: fields_add_pcapfile

# 需要导入模块: from steelscript.appfwk.apps.datasource.models import TableField [as 别名]
# 或者: from steelscript.appfwk.apps.datasource.models.TableField import save [as 别名]
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,代码行数:23,代码来源:wireshark_source.py

示例10: post_process_table

# 需要导入模块: from steelscript.appfwk.apps.datasource.models import TableField [as 别名]
# 或者: from steelscript.appfwk.apps.datasource.models.TableField import save [as 别名]
    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,代码行数:28,代码来源:scc.py

示例11: fields_add_business_hour_fields

# 需要导入模块: from steelscript.appfwk.apps.datasource.models import TableField [as 别名]
# 或者: from steelscript.appfwk.apps.datasource.models.TableField import save [as 别名]
def fields_add_business_hour_fields(obj,
                                    initial_biz_hours_start='8:00am',
                                    initial_biz_hours_end='5:00pm',
                                    initial_biz_hours_tzname='US/Eastern',
                                    initial_biz_hours_weekends=False,
                                    **kwargs):

    kwargs['initial_duration'] = kwargs.get('initial_duration', '1w')
    fields_add_time_selection(obj, show_start=True, **kwargs)

    time_choices = {'choices': zip(TIMES, TIMES)}
    business_hours_start = TableField(keyword='business_hours_start',
                                      label='Start Business',
                                      initial=initial_biz_hours_start,
                                      field_cls=forms.ChoiceField,
                                      field_kwargs=time_choices,
                                      required=True)
    business_hours_start.save()
    obj.fields.add(business_hours_start)

    business_hours_end = TableField(keyword='business_hours_end',
                                    label='End Business',
                                    initial=initial_biz_hours_end,
                                    field_cls=forms.ChoiceField,
                                    field_kwargs=time_choices,
                                    required=True)
    business_hours_end.save()
    obj.fields.add(business_hours_end)

    tz_choices = {'choices': zip(pytz.common_timezones,
                                 pytz.common_timezones)}
    business_hours_tzname = TableField(keyword='business_hours_tzname',
                                       label='Business Timezone',
                                       initial=initial_biz_hours_tzname,
                                       field_cls=forms.ChoiceField,
                                       field_kwargs=tz_choices,
                                       required=True)
    business_hours_tzname.save()
    obj.fields.add(business_hours_tzname)

    business_hours_weekends = TableField(keyword='business_hours_weekends',
                                         field_cls=forms.BooleanField,
                                         label='Business includes weekends',
                                         initial=initial_biz_hours_weekends,
                                         required=False)
    business_hours_weekends.save()
    obj.fields.add(business_hours_weekends)
开发者ID:riverbed,项目名称:steelscript-appfwk-business-hours,代码行数:49,代码来源:business_hours_source.py

示例12: fields_add_time_selection

# 需要导入模块: from steelscript.appfwk.apps.datasource.models import TableField [as 别名]
# 或者: from steelscript.appfwk.apps.datasource.models.TableField import save [as 别名]
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,代码行数:58,代码来源:forms.py


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