Ticket #10164: Django-1.3-sqlite.patch
File Django-1.3-sqlite.patch, 2.2 KB (added by , 14 years ago) |
---|
-
django/db/backends/creation.py
old new 40 40 qn = self.connection.ops.quote_name 41 41 for f in opts.local_fields: 42 42 col_type = f.db_type(connection=self.connection) 43 col_type_suffix = f.db_type_suffix(connection=self.connection) 43 44 tablespace = f.db_tablespace or opts.db_tablespace 44 45 if col_type is None: 45 46 # Skip ManyToManyFields, because they're not represented as … … 64 65 pr = pending_references.setdefault(f.rel.to, []).append((model, f)) 65 66 else: 66 67 field_output.extend(ref_output) 68 if col_type_suffix: 69 field_output.append(style.SQL_KEYWORD(col_type_suffix)) 67 70 table_output.append(' '.join(field_output)) 68 71 for field_constraints in opts.unique_together: 69 72 table_output.append(style.SQL_KEYWORD('UNIQUE') + ' (%s)' % \ -
django/db/backends/sqlite3/creation.py
old new 30 30 'TimeField': 'time', 31 31 } 32 32 33 data_types_suffix = { 34 'AutoField': 'autoincrement', 35 } 36 33 37 def sql_for_pending_references(self, model, style, pending_references): 34 38 "SQLite3 doesn't support constraints" 35 39 return [] -
django/db/models/fields/__init__.py
old new 221 221 except KeyError: 222 222 return None 223 223 224 def db_type_suffix(self, connection): 225 data = DictWrapper(self.__dict__, connection.ops.quote_name, "qn_") 226 try: 227 return connection.creation.data_types_suffix[self.get_internal_type()] % data 228 except (KeyError, AttributeError): 229 return False 230 224 231 def unique(self): 225 232 return self._unique or self.primary_key 226 233 unique = property(unique)