Python django.forms.UUIDField() Examples

The following are 29 code examples of django.forms.UUIDField(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module django.forms , or try the search function .
Example #1
Source File: __init__.py    From openhgsenti with Apache License 2.0 5 votes vote down vote up
def get_internal_type(self):
        return "UUIDField" 
Example #2
Source File: test_uuidfield.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def test_uuidfield_4(self):
        field = UUIDField()
        value = field.prepare_value(uuid.UUID('550e8400e29b41d4a716446655440000'))
        self.assertEqual(value, '550e8400-e29b-41d4-a716-446655440000') 
Example #3
Source File: test_uuidfield.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def test_uuidfield_3(self):
        field = UUIDField()
        with self.assertRaisesMessage(ValidationError, 'Enter a valid UUID.'):
            field.clean('550e8400') 
Example #4
Source File: test_uuidfield.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def test_uuidfield_2(self):
        field = UUIDField(required=False)
        value = field.clean('')
        self.assertIsNone(value) 
Example #5
Source File: test_uuidfield.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def test_uuidfield_1(self):
        field = UUIDField()
        value = field.clean('550e8400e29b41d4a716446655440000')
        self.assertEqual(value, uuid.UUID('550e8400e29b41d4a716446655440000')) 
Example #6
Source File: test_uuidfield.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def test_uuidfield_4(self):
        field = UUIDField()
        value = field.prepare_value(uuid.UUID('550e8400e29b41d4a716446655440000'))
        self.assertEqual(value, '550e8400e29b41d4a716446655440000') 
Example #7
Source File: test_uuidfield.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def test_uuidfield_3(self):
        field = UUIDField()
        with self.assertRaisesMessage(ValidationError, 'Enter a valid UUID.'):
            field.clean('550e8400') 
Example #8
Source File: test_uuidfield.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def test_uuidfield_2(self):
        field = UUIDField(required=False)
        value = field.clean('')
        self.assertIsNone(value) 
Example #9
Source File: test_uuidfield.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def test_uuidfield_1(self):
        field = UUIDField()
        value = field.clean('550e8400e29b41d4a716446655440000')
        self.assertEqual(value, uuid.UUID('550e8400e29b41d4a716446655440000')) 
Example #10
Source File: test_converter.py    From graphene-django with MIT License 5 votes vote down vote up
def test_should_uuid_convert_string():
    if hasattr(forms, "UUIDField"):
        assert_conversion(forms.UUIDField, UUID) 
Example #11
Source File: __init__.py    From python2017 with MIT License 5 votes vote down vote up
def formfield(self, **kwargs):
        defaults = {
            'form_class': forms.UUIDField,
        }
        defaults.update(kwargs)
        return super(UUIDField, self).formfield(**defaults) 
Example #12
Source File: __init__.py    From python2017 with MIT License 5 votes vote down vote up
def get_internal_type(self):
        return "UUIDField" 
Example #13
Source File: __init__.py    From python2017 with MIT License 5 votes vote down vote up
def deconstruct(self):
        name, path, args, kwargs = super(UUIDField, self).deconstruct()
        del kwargs['max_length']
        return name, path, args, kwargs 
Example #14
Source File: __init__.py    From python2017 with MIT License 5 votes vote down vote up
def __init__(self, verbose_name=None, **kwargs):
        kwargs['max_length'] = 32
        super(UUIDField, self).__init__(verbose_name, **kwargs) 
Example #15
Source File: __init__.py    From openhgsenti with Apache License 2.0 5 votes vote down vote up
def formfield(self, **kwargs):
        defaults = {
            'form_class': forms.UUIDField,
        }
        defaults.update(kwargs)
        return super(UUIDField, self).formfield(**defaults) 
Example #16
Source File: __init__.py    From GTDWeb with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, verbose_name=None, **kwargs):
        kwargs['max_length'] = 32
        super(UUIDField, self).__init__(verbose_name, **kwargs) 
Example #17
Source File: __init__.py    From openhgsenti with Apache License 2.0 5 votes vote down vote up
def deconstruct(self):
        name, path, args, kwargs = super(UUIDField, self).deconstruct()
        del kwargs['max_length']
        return name, path, args, kwargs 
Example #18
Source File: __init__.py    From openhgsenti with Apache License 2.0 5 votes vote down vote up
def __init__(self, verbose_name=None, **kwargs):
        kwargs['max_length'] = 32
        super(UUIDField, self).__init__(verbose_name, **kwargs) 
Example #19
Source File: __init__.py    From python with Apache License 2.0 5 votes vote down vote up
def formfield(self, **kwargs):
        defaults = {
            'form_class': forms.UUIDField,
        }
        defaults.update(kwargs)
        return super(UUIDField, self).formfield(**defaults) 
Example #20
Source File: __init__.py    From python with Apache License 2.0 5 votes vote down vote up
def get_internal_type(self):
        return "UUIDField" 
Example #21
Source File: __init__.py    From python with Apache License 2.0 5 votes vote down vote up
def deconstruct(self):
        name, path, args, kwargs = super(UUIDField, self).deconstruct()
        del kwargs['max_length']
        return name, path, args, kwargs 
Example #22
Source File: __init__.py    From python with Apache License 2.0 5 votes vote down vote up
def __init__(self, verbose_name=None, **kwargs):
        kwargs['max_length'] = 32
        super(UUIDField, self).__init__(verbose_name, **kwargs) 
Example #23
Source File: __init__.py    From Hands-On-Application-Development-with-PyCharm with MIT License 5 votes vote down vote up
def formfield(self, **kwargs):
        return super().formfield(**{
            'form_class': forms.UUIDField,
            **kwargs,
        }) 
Example #24
Source File: __init__.py    From Hands-On-Application-Development-with-PyCharm with MIT License 5 votes vote down vote up
def get_internal_type(self):
        return "UUIDField" 
Example #25
Source File: __init__.py    From bioforum with MIT License 5 votes vote down vote up
def formfield(self, **kwargs):
        defaults = {
            'form_class': forms.UUIDField,
        }
        defaults.update(kwargs)
        return super().formfield(**defaults) 
Example #26
Source File: __init__.py    From bioforum with MIT License 5 votes vote down vote up
def get_internal_type(self):
        return "UUIDField" 
Example #27
Source File: __init__.py    From GTDWeb with GNU General Public License v2.0 5 votes vote down vote up
def formfield(self, **kwargs):
        defaults = {
            'form_class': forms.UUIDField,
        }
        defaults.update(kwargs)
        return super(UUIDField, self).formfield(**defaults) 
Example #28
Source File: __init__.py    From GTDWeb with GNU General Public License v2.0 5 votes vote down vote up
def get_internal_type(self):
        return "UUIDField" 
Example #29
Source File: __init__.py    From GTDWeb with GNU General Public License v2.0 5 votes vote down vote up
def deconstruct(self):
        name, path, args, kwargs = super(UUIDField, self).deconstruct()
        del kwargs['max_length']
        return name, path, args, kwargs