Ticket #22744: 22744-1.diff

File 22744-1.diff, 849 bytes (added by Claude Paroz, 10 years ago)
  • django/db/backends/sqlite3/introspection.py

    diff --git a/django/db/backends/sqlite3/introspection.py b/django/db/backends/sqlite3/introspection.py
    index da8629a..f029715 100644
    a b class DatabaseIntrospection(BaseDatabaseIntrospection):  
    7979
    8080        # Schema for this table
    8181        cursor.execute("SELECT sql FROM sqlite_master WHERE tbl_name = %s AND type = %s", [table_name, "table"])
    82         results = cursor.fetchone()[0].strip()
     82        try:
     83            results = cursor.fetchone()[0].strip()
     84        except TypeError:
     85            # It might be a view, then no results will be returned
     86            return relations
    8387        results = results[results.index('(') + 1:results.rindex(')')]
    8488
    8589        # Walk through and look for references to other tables. SQLite doesn't
Back to Top