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


Python options.HORIZONTAL属性代码示例

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


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

示例1: _check_radio_fields_value

# 需要导入模块: from django.contrib.admin import options [as 别名]
# 或者: from django.contrib.admin.options import HORIZONTAL [as 别名]
def _check_radio_fields_value(self, cls, model, val, label):
        """ Check type of a value of `radio_fields` dictionary. """

        from django.contrib.admin.options import HORIZONTAL, VERTICAL

        if val not in (HORIZONTAL, VERTICAL):
            return [
                checks.Error(
                    "The value of '%s' must be either admin.HORIZONTAL or admin.VERTICAL." % label,
                    hint=None,
                    obj=cls,
                    id='admin.E024',
                )
            ]
        else:
            return [] 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:18,代码来源:checks.py

示例2: _check_radio_fields_value

# 需要导入模块: from django.contrib.admin import options [as 别名]
# 或者: from django.contrib.admin.options import HORIZONTAL [as 别名]
def _check_radio_fields_value(self, obj, val, label):
        """ Check type of a value of `radio_fields` dictionary. """

        from django.contrib.admin.options import HORIZONTAL, VERTICAL

        if val not in (HORIZONTAL, VERTICAL):
            return [
                checks.Error(
                    "The value of '%s' must be either admin.HORIZONTAL or admin.VERTICAL." % label,
                    hint=None,
                    obj=obj.__class__,
                    id='admin.E024',
                )
            ]
        else:
            return [] 
开发者ID:drexly,项目名称:openhgsenti,代码行数:18,代码来源:checks.py

示例3: validate_radio_fields

# 需要导入模块: from django.contrib.admin import options [as 别名]
# 或者: from django.contrib.admin.options import HORIZONTAL [as 别名]
def validate_radio_fields(self, cls, model):
        " Validate that radio_fields is a dictionary of choice or foreign key fields. "
        from django.contrib.admin.options import HORIZONTAL, VERTICAL
        if hasattr(cls, 'radio_fields'):
            check_isdict(cls, 'radio_fields', cls.radio_fields)
            for field, val in cls.radio_fields.items():
                f = get_field(cls, model, 'radio_fields', field)
                if not (isinstance(f, models.ForeignKey) or f.choices):
                    raise ImproperlyConfigured("'%s.radio_fields['%s']' "
                            "is neither an instance of ForeignKey nor does "
                            "have choices set." % (cls.__name__, field))
                if val not in (HORIZONTAL, VERTICAL):
                    raise ImproperlyConfigured("'%s.radio_fields['%s']' "
                            "is neither admin.HORIZONTAL nor admin.VERTICAL."
                            % (cls.__name__, field)) 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:17,代码来源:validation.py

示例4: _check_radio_fields_value

# 需要导入模块: from django.contrib.admin import options [as 别名]
# 或者: from django.contrib.admin.options import HORIZONTAL [as 别名]
def _check_radio_fields_value(self, obj, val, label):
        """ Check type of a value of `radio_fields` dictionary. """

        from django.contrib.admin.options import HORIZONTAL, VERTICAL

        if val not in (HORIZONTAL, VERTICAL):
            return [
                checks.Error(
                    "The value of '%s' must be either admin.HORIZONTAL or admin.VERTICAL." % label,
                    obj=obj.__class__,
                    id='admin.E024',
                )
            ]
        else:
            return [] 
开发者ID:reBiocoder,项目名称:bioforum,代码行数:17,代码来源:checks.py


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