      full_statement = [style.SQL_KEYWORD('CREATE TABLE') + ' ' + style.SQL_TABLE(qn(opts.db_table)) + ' (']
      for i, line in enumerate(table_output): # Combine and add commas.
          full_statement.append('    %s%s' % (line, i < len(table_output)-1 and ',' or ''))
      full_statement.append(')')
      if opts.db_tablespace and backend.supports_tablespaces:
          full_statement.append(connection.ops.tablespace_sql(opts.db_tablespace))
      full_statement.append(';')
      final_output.append('\n'.join(full_statement))
  
      if opts.has_auto_field:
 
</s> remove             if tablespace and backend.supports_tablespaces and backend.autoindexes_primary_keys:
 </s> add             if tablespace and connection.features.supports_tablespaces and connection.features.autoindexes_primary_keys: </s> remove             if tablespace and backend.supports_tablespaces:
 </s> add             if tablespace and connection.features.supports_tablespaces: </s> remove         if f.db_index and not ((f.primary_key or f.unique) and backend.autoindexes_primary_keys):
 </s> add         if f.db_index and not ((f.primary_key or f.unique) and connection.features.autoindexes_primary_keys): </s> remove         if f.unique and (not f.primary_key or backend.allows_unique_and_pk):
 </s> add         if f.unique and (not f.primary_key or connection.features.allows_unique_and_pk): </s> remove             if opts.db_tablespace and backend.supports_tablespaces:
 </s> add             if opts.db_tablespace and connection.features.supports_tablespaces:
    if opts.db_tablespace and connection.features.supports_tablespaces:
      full_statement = [style.SQL_KEYWORD('CREATE TABLE') + ' ' + style.SQL_TABLE(qn(opts.db_table)) + ' (']
      for i, line in enumerate(table_output): # Combine and add commas.
          full_statement.append('    %s%s' % (line, i < len(table_output)-1 and ',' or ''))
      full_statement.append(')')
    if opts.db_tablespace and connection.features.supports_tablespaces:
          full_statement.append(connection.ops.tablespace_sql(opts.db_tablespace))
      full_statement.append(';')
      final_output.append('\n'.join(full_statement))
  
      if opts.has_auto_field:
keep keep keep keep replace keep keep keep keep keep
 Implemented BaseDatabaseFeatures and changed all code to access it -- connection.features.foo instead of backend.foo

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5974 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
django/core/management/sql.py