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


Python forms.UUIDField方法代码示例

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


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

示例1: __init__

# 需要导入模块: from django import forms [as 别名]
# 或者: from django.forms import UUIDField [as 别名]
def __init__(self, verbose_name=None, **kwargs):
        kwargs['max_length'] = 32
        super(UUIDField, self).__init__(verbose_name, **kwargs) 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:5,代码来源:__init__.py

示例2: deconstruct

# 需要导入模块: from django import forms [as 别名]
# 或者: from django.forms import UUIDField [as 别名]
def deconstruct(self):
        name, path, args, kwargs = super(UUIDField, self).deconstruct()
        del kwargs['max_length']
        return name, path, args, kwargs 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:6,代码来源:__init__.py

示例3: get_internal_type

# 需要导入模块: from django import forms [as 别名]
# 或者: from django.forms import UUIDField [as 别名]
def get_internal_type(self):
        return "UUIDField" 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:4,代码来源:__init__.py

示例4: formfield

# 需要导入模块: from django import forms [as 别名]
# 或者: from django.forms import UUIDField [as 别名]
def formfield(self, **kwargs):
        defaults = {
            'form_class': forms.UUIDField,
        }
        defaults.update(kwargs)
        return super(UUIDField, self).formfield(**defaults) 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:8,代码来源:__init__.py

示例5: formfield

# 需要导入模块: from django import forms [as 别名]
# 或者: from django.forms import UUIDField [as 别名]
def formfield(self, **kwargs):
        defaults = {
            'form_class': forms.UUIDField,
        }
        defaults.update(kwargs)
        return super().formfield(**defaults) 
开发者ID:reBiocoder,项目名称:bioforum,代码行数:8,代码来源:__init__.py

示例6: formfield

# 需要导入模块: from django import forms [as 别名]
# 或者: from django.forms import UUIDField [as 别名]
def formfield(self, **kwargs):
        return super().formfield(**{
            'form_class': forms.UUIDField,
            **kwargs,
        }) 
开发者ID:PacktPublishing,项目名称:Hands-On-Application-Development-with-PyCharm,代码行数:7,代码来源:__init__.py

示例7: test_should_uuid_convert_string

# 需要导入模块: from django import forms [as 别名]
# 或者: from django.forms import UUIDField [as 别名]
def test_should_uuid_convert_string():
    if hasattr(forms, "UUIDField"):
        assert_conversion(forms.UUIDField, UUID) 
开发者ID:graphql-python,项目名称:graphene-django,代码行数:5,代码来源:test_converter.py

示例8: test_uuidfield_1

# 需要导入模块: from django import forms [as 别名]
# 或者: from django.forms import UUIDField [as 别名]
def test_uuidfield_1(self):
        field = UUIDField()
        value = field.clean('550e8400e29b41d4a716446655440000')
        self.assertEqual(value, uuid.UUID('550e8400e29b41d4a716446655440000')) 
开发者ID:nesdis,项目名称:djongo,代码行数:6,代码来源:test_uuidfield.py

示例9: test_uuidfield_2

# 需要导入模块: from django import forms [as 别名]
# 或者: from django.forms import UUIDField [as 别名]
def test_uuidfield_2(self):
        field = UUIDField(required=False)
        value = field.clean('')
        self.assertIsNone(value) 
开发者ID:nesdis,项目名称:djongo,代码行数:6,代码来源:test_uuidfield.py

示例10: test_uuidfield_3

# 需要导入模块: from django import forms [as 别名]
# 或者: from django.forms import UUIDField [as 别名]
def test_uuidfield_3(self):
        field = UUIDField()
        with self.assertRaisesMessage(ValidationError, 'Enter a valid UUID.'):
            field.clean('550e8400') 
开发者ID:nesdis,项目名称:djongo,代码行数:6,代码来源:test_uuidfield.py

示例11: test_uuidfield_4

# 需要导入模块: from django import forms [as 别名]
# 或者: from django.forms import UUIDField [as 别名]
def test_uuidfield_4(self):
        field = UUIDField()
        value = field.prepare_value(uuid.UUID('550e8400e29b41d4a716446655440000'))
        self.assertEqual(value, '550e8400e29b41d4a716446655440000') 
开发者ID:nesdis,项目名称:djongo,代码行数:6,代码来源:test_uuidfield.py

示例12: test_uuidfield_4

# 需要导入模块: from django import forms [as 别名]
# 或者: from django.forms import UUIDField [as 别名]
def test_uuidfield_4(self):
        field = UUIDField()
        value = field.prepare_value(uuid.UUID('550e8400e29b41d4a716446655440000'))
        self.assertEqual(value, '550e8400-e29b-41d4-a716-446655440000') 
开发者ID:nesdis,项目名称:djongo,代码行数:6,代码来源:test_uuidfield.py


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