From ae19315b4d8a19eda07ea8f313c485ca0a7875d0 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sun, 11 Aug 2013 14:23:31 +0100 Subject: Support index_together during model creation --- django/db/backends/sqlite3/introspection.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'django/db/backends/sqlite3') diff --git a/django/db/backends/sqlite3/introspection.py b/django/db/backends/sqlite3/introspection.py index 2e674bc05b..92777dd910 100644 --- a/django/db/backends/sqlite3/introspection.py +++ b/django/db/backends/sqlite3/introspection.py @@ -168,7 +168,10 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): """ # Don't use PRAGMA because that causes issues with some transactions cursor.execute("SELECT sql FROM sqlite_master WHERE tbl_name = %s AND type = %s", [table_name, "table"]) - results = cursor.fetchone()[0].strip() + row = cursor.fetchone() + if row is None: + raise ValueError("Table %s does not exist" % table_name) + results = row[0].strip() results = results[results.index('(') + 1:results.rindex(')')] for field_desc in results.split(','): field_desc = field_desc.strip() -- cgit v1.3