本文整理汇总了Python中colanderalchemy.SQLAlchemySchemaNode.add_nodes方法的典型用法代码示例。如果您正苦于以下问题:Python SQLAlchemySchemaNode.add_nodes方法的具体用法?Python SQLAlchemySchemaNode.add_nodes怎么用?Python SQLAlchemySchemaNode.add_nodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类colanderalchemy.SQLAlchemySchemaNode
的用法示例。
在下文中一共展示了SQLAlchemySchemaNode.add_nodes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_nodes
# 需要导入模块: from colanderalchemy import SQLAlchemySchemaNode [as 别名]
# 或者: from colanderalchemy.SQLAlchemySchemaNode import add_nodes [as 别名]
def add_nodes(self, includes, excludes, overrides):
SQLAlchemySchemaNode.add_nodes(self, includes, excludes, overrides)
start = colander.SchemaNode(colander.Int(),
name='start',
title='Start',
missing=0,
default=0,
validator=colander.Range(min=0))
limit = colander.SchemaNode(colander.Int(),
name='limit',
title='Limit',
missing=25,
default=25,
validator=colander.Range(min=1))
values = [prop.key for prop in self.inspector.column_attrs]
order_by = colander.SchemaNode(colander.String(),
name='order_by',
title='Order By',
missing=values[0],
default=values[0],
validator=colander.OneOf(values))
direction_values = ['asc', 'desc']
validator = colander.OneOf(direction_values)
direction = colander.SchemaNode(colander.String(),
name='direction',
title='Direction',
missing='asc',
default='asc',
validator=validator)
intersect = colander.SchemaNode(colander.Boolean(),
name='intersect',
title='Intersect Criterions',
missing=True,
default=True)
self.order_by_values = values
self.direction_values = direction_values
self.add(start)
self.add(limit)
self.add(order_by)
self.add(direction)
self.add(intersect)