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


Python layout.Column方法代码示例

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


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

示例1: helper

# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Column [as 别名]
def helper(self):
        # As extra service, auto-adjust the layout based on the project settings.
        # This allows defining the top-row, and still get either 2 or 3 columns
        compact_fields = [name for name in self.fields.keys() if name in self.top_row_fields]
        other_fields = [name for name in self.fields.keys() if name not in self.top_row_fields]
        col_size = int(self.top_row_columns / len(compact_fields))
        col_class = self.top_column_class.format(size=col_size)

        compact_row = Row(*[Column(name, css_class=col_class) for name in compact_fields])

        # The fields are already ordered by the AbstractCommentForm.__init__ method.
        # See where the compact row should be.
        pos = list(self.fields.keys()).index(compact_fields[0])
        new_fields = other_fields
        new_fields.insert(pos, compact_row)

        helper = CompactLabelsCommentFormHelper()
        helper.layout = Layout(*new_fields)
        helper.add_input(SubmitButton())
        helper.add_input(PreviewButton())
        return helper 
开发者ID:82Flex,项目名称:DCRM,代码行数:23,代码来源:compact.py


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