Code

Ticket #708: 708-1.diff

File 708-1.diff, 660 bytes (added by mattmcc, 6 years ago)
Line 
1Index: django/db/backends/postgresql/operations.py
2===================================================================
3--- django/db/backends/postgresql/operations.py (revision 6685)
4+++ django/db/backends/postgresql/operations.py (working copy)
5@@ -27,6 +27,11 @@
6     def deferrable_sql(self):
7         return " DEFERRABLE INITIALLY DEFERRED"
8 
9+    def field_cast_sql(self, db_type):
10+        if db_type == 'inet':
11+            return 'CAST(%s AS TEXT)'
12+        return '%s'
13+
14     def last_insert_id(self, cursor, table_name, pk_name):
15         cursor.execute("SELECT CURRVAL('\"%s_%s_seq\"')" % (table_name, pk_name))
16         return cursor.fetchone()[0]