From b718acf00589131fca0ee5cfa91df412b351bc48 Mon Sep 17 00:00:00 2001 From: Ben Konrath Date: Sun, 17 Mar 2013 16:23:01 +0100 Subject: [PATCH] Update db_type method for Django >= 1.4 DB settings format. --- polymorphic/tools_for_tests.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/polymorphic/tools_for_tests.py b/polymorphic/tools_for_tests.py index 1646a4a..9c75bb8 100644 --- a/polymorphic/tools_for_tests.py +++ b/polymorphic/tools_for_tests.py @@ -84,7 +84,9 @@ class UUIDField(models.CharField): def db_type(self, connection): from django.conf import settings - return UUIDField._CREATE_COLUMN_TYPES.get(settings.DATABASE_ENGINE, "char(%s)" % self.max_length) + full_database_type = settings.DATABASES['default']['ENGINE'] + database_type = full_database_type.split('.')[-1] + return UUIDField._CREATE_COLUMN_TYPES.get(database_type, "char(%s)" % self.max_length) def to_python(self, value): """Return a uuid.UUID instance from the value returned by the database."""