Here are the examples of the python api django.forms.UUIDField taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
8 Examples
0
View Complete Implementation : converter.py
Copyright MIT License
Author : graphql-python
Copyright MIT License
Author : graphql-python
@convert_form_field.register(forms.UUIDField)
def convert_form_field_to_uuid(field):
return UUID(description=field.help_text, required=field.required)
0
View Complete Implementation : test_converter.py
Copyright MIT License
Author : graphql-python
Copyright MIT License
Author : graphql-python
def test_should_uuid_convert_string():
if hasattr(forms, "UUIDField"):
astert_conversion(forms.UUIDField, UUID)
0
View Complete Implementation : test_uuidfield.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
Copyright GNU Affero General Public License v3.0
Author : nesdis
def test_uuidfield_1(self):
field = UUIDField()
value = field.clean('550e8400e29b41d4a716446655440000')
self.astertEqual(value, uuid.UUID('550e8400e29b41d4a716446655440000'))
0
View Complete Implementation : test_uuidfield.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
Copyright GNU Affero General Public License v3.0
Author : nesdis
def test_uuidfield_2(self):
field = UUIDField(required=False)
value = field.clean('')
self.astertIsNone(value)
0
View Complete Implementation : test_uuidfield.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
Copyright GNU Affero General Public License v3.0
Author : nesdis
def test_uuidfield_3(self):
field = UUIDField()
with self.astertRaisesMessage(ValidationError, 'Enter a valid UUID.'):
field.clean('550e8400')
0
View Complete Implementation : test_uuidfield.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
Copyright GNU Affero General Public License v3.0
Author : nesdis
def test_uuidfield_4(self):
field = UUIDField()
value = field.prepare_value(uuid.UUID('550e8400e29b41d4a716446655440000'))
self.astertEqual(value, '550e8400e29b41d4a716446655440000')
0
View Complete Implementation : test_uuidfield.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
Copyright GNU Affero General Public License v3.0
Author : nesdis
def test_clean_value_with_dashes(self):
field = UUIDField()
value = field.clean('550e8400-e29b-41d4-a716-446655440000')
self.astertEqual(value, uuid.UUID('550e8400e29b41d4a716446655440000'))
0
View Complete Implementation : test_uuidfield.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
Copyright GNU Affero General Public License v3.0
Author : nesdis
def test_uuidfield_4(self):
field = UUIDField()
value = field.prepare_value(uuid.UUID('550e8400e29b41d4a716446655440000'))
self.astertEqual(value, '550e8400-e29b-41d4-a716-446655440000')