Created
February 10, 2021 18:16
-
-
Save gigidn/871fd0a0d8009aa38cd46438f956e36c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UUID(Field): | |
""" Encapsulates an :class:`UUID`. """ | |
type = 'uuid.UUID' | |
column_type = ('uuid', 'uuid') | |
def convert_to_column(self, value, record, values=None, validate=True): | |
return str(value) | |
def convert_to_cache(self, value, record, validate=True): | |
return str(value) | |
def convert_to_record(self, value, record): | |
if not value: | |
return None | |
return uuid.UUID(value) | |
def convert_to_read(self, value, record, use_name_get=True): | |
return str(value) | |
def convert_to_export(self, value, record): | |
if value: | |
return str(value) | |
return '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment