Ticket #4999: xx.diff
File xx.diff, 3.3 KB (added by , 17 years ago) |
---|
-
db/models/options.py
78 78 79 79 # If the db_table wasn't provided, use the app_label + module_name. 80 80 if not self.db_table: 81 self.db_table = "%s_%s" % (self.app_label, self.module_name) 81 try: 82 prefix = settings.DATABASE_TABLE_PREFIX 83 except AttributeError: 84 prefix = '' 85 86 self.db_table = "%s%s_%s" % (prefix, self.app_label, self.module_name) 82 87 self.db_table = truncate_name(self.db_table, 83 88 backend.get_max_name_length()) 84 89 -
db/backends/util.py
13 13 self.cursor = cursor 14 14 self.db = db 15 15 16 try: 17 from django.conf import settings 18 self.debug_query = settings.DEBUG_QUERY 19 except AttributeError: 20 self.debug_query = False 21 16 22 def execute(self, sql, params=()): 17 23 start = time() 18 24 try: … … 24 30 'time': "%.3f" % (stop - start), 25 31 }) 26 32 33 if self.debug_query: 34 print 'QUERY:', self.db.queries[-1]['sql'] 35 27 36 def executemany(self, sql, param_list): 28 37 start = time() 29 38 try: … … 35 44 'time': "%.3f" % (stop - start), 36 45 }) 37 46 47 if self.debug_query: 48 print 'QUERY:', self.db.queries[-1]['sql'] 49 38 50 def __getattr__(self, attr): 39 51 if attr in self.__dict__: 40 52 return self.__dict__[attr] -
core/management.py
276 276 style.SQL_TABLE(backend.quote_name(f.rel.to._meta.db_table)), 277 277 style.SQL_FIELD(backend.quote_name(f.rel.to._meta.pk.column)), 278 278 backend.get_deferrable_sql())) 279 280 if hasattr(f, 'contribute_to_table'): 281 f.contribute_to_table(table_output, backend, style) 282 279 283 table_output.append(' %s (%s, %s)%s' % \ 280 284 (style.SQL_KEYWORD('UNIQUE'), 281 285 style.SQL_FIELD(backend.quote_name(f.m2m_column_name())), 282 286 style.SQL_FIELD(backend.quote_name(f.m2m_reverse_name())), 283 287 tablespace_sql)) 288 284 289 table_output.append(')') 285 290 if opts.db_tablespace and backend.supports_tablespaces: 286 291 # f.db_tablespace is only for indices, so ignore its value here. … … 1701 1706 # way. For example, if this file (manage.py) lives in a directory 1702 1707 # "myproject", this code would add "/path/to/myproject" to sys.path. 1703 1708 project_directory, settings_filename = os.path.split(settings_mod.__file__) 1709 1710 if project_directory == '': 1711 project_directory = os.getcwd() 1712 1704 1713 project_name = os.path.basename(project_directory) 1705 1714 settings_name = os.path.splitext(settings_filename)[0] 1706 1715 sys.path.append(os.path.join(project_directory, '..'))