Commits

Matthew Schinckel committed 8722e6c

Allow 36 chars, so - segmented string works okay

  • Participants
  • Parent commits cd01a86

Comments (0)

Files changed (1)

uuidfield/fields.py

         
         self.auto = auto
         
-        kwargs['max_length'] = 32
+        kwargs['max_length'] = 36
         if auto:
             kwargs['editable'] = False
             kwargs['blank'] = True
     def to_python(self, value):
         if not value:
             return None
-        if len(value) != 32:
-            value = value.replace('-', '')
-        assert len(value) == 32
-        return value
+        if isinstance(value, uuid.UUID):
+            return value.hex
+        return uuid.UUID(value).hex
     
     
     def value_to_string(self, obj):