summaryrefslogtreecommitdiff
path: root/django/db/backends
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/backends')
-rw-r--r--django/db/backends/mysql/base.py1
-rw-r--r--django/db/backends/postgresql/operations.py5
2 files changed, 5 insertions, 1 deletions
diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py
index ba3e9efda8..697dcd3a67 100644
--- a/django/db/backends/mysql/base.py
+++ b/django/db/backends/mysql/base.py
@@ -21,7 +21,6 @@ if (version < (1,2,1) or (version[:3] == (1, 2, 1) and
from MySQLdb.converters import conversions
from MySQLdb.constants import FIELD_TYPE
-import types
import re
# Raise exceptions for database warnings if DEBUG is on
diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py
index 20392b238e..15ca957bac 100644
--- a/django/db/backends/postgresql/operations.py
+++ b/django/db/backends/postgresql/operations.py
@@ -27,6 +27,11 @@ class DatabaseOperations(BaseDatabaseOperations):
def deferrable_sql(self):
return " DEFERRABLE INITIALLY DEFERRED"
+ def field_cast_sql(self, db_type):
+ if db_type == 'inet':
+ return 'HOST(%s)'
+ return '%s'
+
def last_insert_id(self, cursor, table_name, pk_name):
cursor.execute("SELECT CURRVAL('\"%s_%s_seq\"')" % (table_name, pk_name))
return cursor.fetchone()[0]