當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。