diff options
| author | Claude Paroz <claude@2xlibre.net> | 2014-06-01 22:03:33 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2014-06-01 22:07:22 +0200 |
| commit | a2fb5c9d69b0a7bfbb7f5576eb9e801c159a1f0b (patch) | |
| tree | 59b166775551c371d472fcfc383c70b1cae1bee4 | |
| parent | d773a08b270e3b2c387985a9d9a4d01c991469c8 (diff) | |
[1.7.x] Fixed #22744 -- Fixed sqlite3 get_relations introspection with views
Thanks Tim Graham for the report and Simon Charette for the review.
Backport of 5a504a5311 from master.
| -rw-r--r-- | django/db/backends/sqlite3/introspection.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/django/db/backends/sqlite3/introspection.py b/django/db/backends/sqlite3/introspection.py index da8629ace6..f029715cf2 100644 --- a/django/db/backends/sqlite3/introspection.py +++ b/django/db/backends/sqlite3/introspection.py @@ -79,7 +79,11 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): # Schema for this table cursor.execute("SELECT sql FROM sqlite_master WHERE tbl_name = %s AND type = %s", [table_name, "table"]) - results = cursor.fetchone()[0].strip() + try: + results = cursor.fetchone()[0].strip() + except TypeError: + # It might be a view, then no results will be returned + return relations results = results[results.index('(') + 1:results.rindex(')')] # Walk through and look for references to other tables. SQLite doesn't |
