1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Support index_together during model creation

This commit is contained in:
Andrew Godwin
2013-08-11 14:23:31 +01:00
parent 21be9fef7b
commit ae19315b4d
4 changed files with 40 additions and 2 deletions

View File

@@ -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()