Index: django/db/models/options.py
===================================================================
--- django/db/models/options.py	(revision 6635)
+++ django/db/models/options.py	(working copy)
@@ -15,7 +15,7 @@
 
 DEFAULT_NAMES = ('verbose_name', 'db_table', 'ordering',
                  'unique_together', 'permissions', 'get_latest_by',
-                 'order_with_respect_to', 'app_label', 'db_tablespace')
+                 'order_with_respect_to', 'app_label', 'db_tablespace', 'sql_generation_required')
 
 class Options(object):
     def __init__(self, meta):
@@ -30,6 +30,7 @@
         self.get_latest_by = None
         self.order_with_respect_to = None
         self.db_tablespace = None
+        self.sql_generation_required = True
         self.admin = None
         self.meta = meta
         self.pk = None
Index: django/core/management/sql.py
===================================================================
--- django/core/management/sql.py	(revision 6635)
+++ django/core/management/sql.py	(working copy)
@@ -13,20 +13,24 @@
     cursor = connection.cursor()
     return get_introspection_module().get_table_list(cursor)
 
-def django_table_list(only_existing=False):
+def django_table_list(only_existing=False, filter_if_sql_generation_not_required=False):
     """
     Returns a list of all table names that have associated Django models and
     are in INSTALLED_APPS.
 
     If only_existing is True, the resulting list will only include the tables
     that actually exist in the database.
+
+    If filter_if_sql_generation_not_required is True, then all tables with associated Django models
+    which have Meta option sql_generation_required=False will not be added to the list.
     """
     from django.db import models
     tables = []
     for app in models.get_apps():
         for model in models.get_models(app):
-            tables.append(model._meta.db_table)
-            tables.extend([f.m2m_db_table() for f in model._meta.many_to_many])
+            if (not filter_if_sql_generation_not_required) or (model._meta.sql_generation_required):
+                tables.append(model._meta.db_table)
+                tables.extend([f.m2m_db_table() for f in model._meta.many_to_many])
     if only_existing:
         existing = table_list()
         tables = [t for t in tables if t in existing]
@@ -45,8 +49,13 @@
         converter = lambda x: x
     return set([m for m in all_models if converter(m._meta.db_table) in map(converter, table_list)])
 
-def sequence_list():
-    "Returns a list of information about all DB sequences for all models in all apps."
+def sequence_list(filter_if_sql_generation_not_required=False):
+    """
+    Returns a list of information about all DB sequences for all models in all apps.
+
+    If filter_if_sql_generation_not_required is True, then only the sequences for the Django models
+    which have Meta option sql_generation_required=False will be added to the list.
+    """
     from django.db import models
 
     apps = models.get_apps()
@@ -54,10 +63,11 @@
 
     for app in apps:
         for model in models.get_models(app):
-            for f in model._meta.fields:
-                if isinstance(f, models.AutoField):
-                    sequence_list.append({'table': model._meta.db_table, 'column': f.column})
-                    break # Only one AutoField is allowed per model, so don't bother continuing.
+            if (not filter_if_sql_generation_not_required) or (model._meta.sql_generation_required):
+                for f in model._meta.fields:
+                    if isinstance(f, models.AutoField):
+                        sequence_list.append({'table': model._meta.db_table, 'column': f.column})
+                        break # Only one AutoField is allowed per model, so don't bother continuing.
 
             for f in model._meta.many_to_many:
                 sequence_list.append({'table': f.m2m_db_table(), 'column': None})
@@ -155,8 +165,9 @@
     for model in app_models:
         if cursor and table_name_converter(model._meta.db_table) in table_names:
             # Drop the table now
-            output.append('%s %s;' % (style.SQL_KEYWORD('DROP TABLE'),
-                style.SQL_TABLE(qn(model._meta.db_table))))
+            if model._meta.sql_generation_required:
+                output.append('%s %s;' % (style.SQL_KEYWORD('DROP TABLE'),
+                    style.SQL_TABLE(qn(model._meta.db_table))))
             if connection.features.supports_constraints and model in references_to_delete:
                 for rel_class, f in references_to_delete[model]:
                     table = rel_class._meta.db_table
@@ -164,11 +175,12 @@
                     r_table = model._meta.db_table
                     r_col = model._meta.get_field(f.rel.field_name).column
                     r_name = '%s_refs_%s_%x' % (col, r_col, abs(hash((table, r_table))))
-                    output.append('%s %s %s %s;' % \
-                        (style.SQL_KEYWORD('ALTER TABLE'),
-                        style.SQL_TABLE(qn(table)),
-                        style.SQL_KEYWORD(connection.ops.drop_foreignkey_sql()),
-                        style.SQL_FIELD(truncate_name(r_name, connection.ops.max_name_length()))))
+                    if rel_class._meta.sql_generation_required:
+                        output.append('%s %s %s %s;' % \
+                            (style.SQL_KEYWORD('ALTER TABLE'),
+                            style.SQL_TABLE(qn(table)),
+                            style.SQL_KEYWORD(connection.ops.drop_foreignkey_sql()),
+                            style.SQL_FIELD(truncate_name(r_name, connection.ops.max_name_length()))))
                 del references_to_delete[model]
             if model._meta.has_auto_field:
                 ds = connection.ops.drop_sequence_sql(model._meta.db_table)
@@ -203,16 +215,16 @@
 def sql_flush(style, only_django=False):
     """
     Returns a list of the SQL statements used to flush the database.
-    
+
     If only_django is True, then only table names that have associated Django
     models and are in INSTALLED_APPS will be included.
     """
     from django.db import connection
     if only_django:
-        tables = django_table_list()
+        tables = django_table_list(filter_if_sql_generation_not_required=True)
     else:
         tables = table_list()
-    statements = connection.ops.sql_flush(style, tables, sequence_list())
+    statements = connection.ops.sql_flush(style, tables, sequence_list(filter_if_sql_generation_not_required=True))
     return statements
 
 def sql_custom(app):
@@ -291,22 +303,24 @@
         table_output.append(style.SQL_KEYWORD('UNIQUE') + ' (%s)' % \
             ", ".join([qn(style.SQL_FIELD(opts.get_field(f).column)) for f in field_constraints]))
 
-    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))
+    # Now build up the CREATE TABLE section but only if the model requires it
+    if opts.sql_generation_required:
+        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:
-        # Add any extra SQL needed to support auto-incrementing primary keys.
-        auto_column = opts.auto_field.db_column or opts.auto_field.name
-        autoinc_sql = connection.ops.autoinc_sql(opts.db_table, auto_column)
-        if autoinc_sql:
-            for stmt in autoinc_sql:
-                final_output.append(stmt)
+        if opts.has_auto_field:
+            # Add any extra SQL needed to support auto-incrementing primary keys.
+            auto_column = opts.auto_field.db_column or opts.auto_field.name
+            autoinc_sql = connection.ops.autoinc_sql(opts.db_table, auto_column)
+            if autoinc_sql:
+                for stmt in autoinc_sql:
+                    final_output.append(stmt)
 
     return final_output, pending_references
 
@@ -331,10 +345,11 @@
                 # For MySQL, r_name must be unique in the first 64 characters.
                 # So we are careful with character usage here.
                 r_name = '%s_refs_%s_%x' % (r_col, col, abs(hash((r_table, table))))
-                final_output.append(style.SQL_KEYWORD('ALTER TABLE') + ' %s ADD CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s (%s)%s;' % \
-                    (qn(r_table), truncate_name(r_name, connection.ops.max_name_length()),
-                    qn(r_col), qn(table), qn(col),
-                    connection.ops.deferrable_sql()))
+                if rel_opts.sql_generation_required:
+                    final_output.append(style.SQL_KEYWORD('ALTER TABLE') + ' %s ADD CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s (%s)%s;' % \
+                        (qn(r_table), truncate_name(r_name, connection.ops.max_name_length()),
+                        qn(r_col), qn(table), qn(col),
+                        connection.ops.deferrable_sql()))
             del pending_references[model]
     return final_output
 
@@ -426,22 +441,23 @@
     output = []
 
     qn = connection.ops.quote_name
-    for f in model._meta.fields:
-        if f.db_index and not ((f.primary_key or f.unique) and connection.features.autoindexes_primary_keys):
-            unique = f.unique and 'UNIQUE ' or ''
-            tablespace = f.db_tablespace or model._meta.db_tablespace
-            if tablespace and connection.features.supports_tablespaces:
-                tablespace_sql = ' ' + connection.ops.tablespace_sql(tablespace)
-            else:
-                tablespace_sql = ''
-            output.append(
-                style.SQL_KEYWORD('CREATE %sINDEX' % unique) + ' ' + \
-                style.SQL_TABLE(qn('%s_%s' % (model._meta.db_table, f.column))) + ' ' + \
-                style.SQL_KEYWORD('ON') + ' ' + \
-                style.SQL_TABLE(qn(model._meta.db_table)) + ' ' + \
-                "(%s)" % style.SQL_FIELD(qn(f.column)) + \
-                "%s;" % tablespace_sql
-            )
+    if model._meta.sql_generation_required:
+        for f in model._meta.fields:
+            if f.db_index and not ((f.primary_key or f.unique) and connection.features.autoindexes_primary_keys):
+                unique = f.unique and 'UNIQUE ' or ''
+                tablespace = f.db_tablespace or model._meta.db_tablespace
+                if tablespace and connection.features.supports_tablespaces:
+                    tablespace_sql = ' ' + connection.ops.tablespace_sql(tablespace)
+                else:
+                    tablespace_sql = ''
+                output.append(
+                    style.SQL_KEYWORD('CREATE %sINDEX' % unique) + ' ' + \
+                    style.SQL_TABLE(qn('%s_%s' % (model._meta.db_table, f.column))) + ' ' + \
+                    style.SQL_KEYWORD('ON') + ' ' + \
+                    style.SQL_TABLE(qn(model._meta.db_table)) + ' ' + \
+                    "(%s)" % style.SQL_FIELD(qn(f.column)) + \
+                    "%s;" % tablespace_sql
+                )
     return output
 
 def emit_post_sync_signal(created_models, verbosity, interactive):
Index: docs/model-api.txt
===================================================================
--- docs/model-api.txt	(revision 6635)
+++ docs/model-api.txt	(working copy)
@@ -1149,6 +1149,28 @@
 that aren't allowed in Python variable names -- notably, the hyphen --
 that's OK. Django quotes column and table names behind the scenes.
 
+``sql_generation_required``
+---------------------------
+
+**New in Django development version**
+
+Marks this model as requiring SQL operations when calling ``manage.py``::
+
+    sql_generation_required = True
+
+If this isn't given, Django will use ``sql_generation_required = True``
+what means that the operations like ``manage.py sqlreset``, ``manage.py syncdb``
+and others will regenerate the appropriate table when needed.
+If the option is set to False, the appropriate table will not be touched with
+any SQL operations.
+
+This is useful for databases where some DB tables are controlled by Django models,
+but some DB tables and views are created via raw SQL and should not be affected
+by any ``manage.py`` actions.
+Note that if the initial SQL data is provided (see `Providing initial SQL
+data`_ below), it still will be present in the output of
+``sqlall``/``sqlcustom`` commands.
+
 ``db_tablespace``
 -----------------
 
