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


Python BaseFormHelper.attrs['novalidate']方法代码示例

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


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

示例1: setHelper

# 需要导入模块: from utils.forms import BaseFormHelper [as 别名]
# 或者: from utils.forms.BaseFormHelper import attrs['novalidate'] [as 别名]
    def setHelper(self):
        # by default take-up the whole row-fluid
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'
            if type(widget) == forms.Textarea:
                widget.attrs['rows'] = 3
                widget.attrs['class'] += " html5text"

        if self.instance.id:
            inputs = {
                "legend_text": "Update {}".format(self.instance),
                "help_text":   "Update an existing HAWC assessment.<br><br>* required fields",
                "cancel_url": self.instance.get_absolute_url()
            }
        else:
            inputs = {
                "legend_text": "Create new assessment",
                "help_text":   """
                    Assessments are the fundamental objects in HAWC; all data added to the
                    tool will be related to an assessment. The settings below are used to
                    describe the basic characteristics of the assessment, along with setting
                    up permissions for role-based authorization and access for viewing and
                    editing content associated with an assessment.<br><br>* required fields""",
                "cancel_url": reverse_lazy('portal')
            }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = None
        helper.add_fluid_row('name', 2, "span6")
        helper.add_fluid_row('version', 2, "span6")
        helper.add_fluid_row('project_manager', 3, "span4")
        helper.attrs['novalidate'] = ''
        return helper
开发者ID:shapiromatron,项目名称:hawc,代码行数:37,代码来源:forms.py


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