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


Python models.BaseSetting方法代码示例

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


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

示例1: _add_setting

# 需要导入模块: from wagtail.contrib.settings import models [as 别名]
# 或者: from wagtail.contrib.settings.models import BaseSetting [as 别名]
def _add_setting(cls: Type[BaseSetting], node: str, dict_params: dict) -> Type[DjangoObjectType]:
    if not hasattr(cls, 'name'):    # we always need a name field
        cls.name = cls.__name__
    dict_params['Meta'].interfaces += (Settings,)
    tp = type(node, (DjangoObjectType,), dict_params)  # type: Type[DjangoObjectType]
    registry.settings[node] = (tp, cls)
    return tp 
开发者ID:tr11,项目名称:wagtail-graphql,代码行数:9,代码来源:actions.py

示例2: _register_model

# 需要导入模块: from wagtail.contrib.settings import models [as 别名]
# 或者: from wagtail.contrib.settings.models import BaseSetting [as 别名]
def _register_model(registered: Set[type], cls: type, snippet: bool,
                    app: str, prefix: str, override_name=None) -> None:
    if cls in registered:
        return

    prefix = prefix.format(app=string.capwords(app),
                           cls=cls.__name__)
    node = override_name or prefix + cls.__name__

    # dict parameters to create GraphQL type
    class Meta:
        model = cls
        interfaces = (graphene.relay.Node, ) if RELAY else tuple()

    dict_params = {'Meta': Meta}

    # add streamfield handlers
    _add_streamfields(cls, node, dict_params, app, prefix)

    if snippet:
        _add_snippet(cls, node, dict_params)
    elif issubclass(cls, AbstractForm):
        _add_form(cls, node, dict_params)
    elif issubclass(cls, wagtailPage):
        _add_page(cls, node, dict_params)
    elif issubclass(cls, BaseSetting):
        _add_setting(cls, node, dict_params)
    else:  # Django Model
        _add_django_model(cls, node, dict_params)

    registered.add(cls) 
开发者ID:tr11,项目名称:wagtail-graphql,代码行数:33,代码来源:actions.py


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