diff options
| author | Josh Smeaton <josh.smeaton@gmail.com> | 2015-02-12 13:25:12 +1100 |
|---|---|---|
| committer | Josh Smeaton <josh.smeaton@gmail.com> | 2015-02-13 09:45:53 +1100 |
| commit | de0241eb985c6dec978beda119fee353ef3e9604 (patch) | |
| tree | 188fe90c269ffbe18072b67efb10252730e79ed8 /django | |
| parent | d64baaef3b95abe9ae5d07317c9bf4df02cb8592 (diff) | |
Fixed #24319 -- Added validation for UUID model field
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/fields/__init__.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index cf5b6d7ef7..8cb83195a8 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -2382,12 +2382,12 @@ class UUIDField(Field): return "UUIDField" def get_db_prep_value(self, value, connection, prepared=False): + if isinstance(value, six.string_types): + value = uuid.UUID(value.replace('-', '')) if isinstance(value, uuid.UUID): if connection.features.has_native_uuid_field: return value return value.hex - if isinstance(value, six.string_types): - return value.replace('-', '') return value def to_python(self, value): |
