1. Andrew Godwin
  2. south

Commits

Andrew Godwin  committed 186663d

Fix UUIDs on PostgreSQL

  • Participants
  • Parent commits fe5e4d8
  • Branches default

Comments (0)

Files changed (1)

File south/db/postgresql_psycopg2.py

View file
+import uuid
 from django.db.backends.util import truncate_name
 from south.db import generic
 
         "Rename an index individually"
         generic.DatabaseOperations.rename_table(self, old_index_name, index_name)
 
+    def _default_value_workaround(self, value):
+        "Support for UUIDs on psql"
+        if isinstance(value, uuid.UUID):
+            return str(value)
+        else:
+            return super(DatabaseOperations, self)._default_value_workaround(value)
+
     def _db_type_for_alter_column(self, field): 
         return self._db_positive_type_for_alter_column(DatabaseOperations, field)