Update db_type method for Django >= 1.4 DB settings format.

fix_request_path_info
Ben Konrath 2013-03-17 16:23:01 +01:00
parent 1ef9e068df
commit b718acf005
1 changed files with 3 additions and 1 deletions

View File

@ -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."""