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


Python IField.required方法代码示例

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


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

示例1: schema_from_model

# 需要导入模块: from zope.schema.interfaces import IField [as 别名]
# 或者: from zope.schema.interfaces.IField import required [as 别名]
def schema_from_model(model):
    table = model.__table__
    bases = (Interface,)
    attrs = {}
    for i, column in enumerate(table.columns):
        if len(column.foreign_keys) or column.primary_key:
            continue
        field = IField(column.type)
        field.__name__ = str(column.name)
        field.title = unicode(column.name)
        field.required = not column.nullable
        attrs[column.name] = field
        field.order = i
       
    return InterfaceClass(name=model.__table__.name,
                          bases=bases,
                          attrs=attrs,
                          __doc__='Generated from metadata')
开发者ID:hexsprite,项目名称:plock,代码行数:20,代码来源:schema.py


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