Fixed too many parentheses in inspectdb Meta.unique_together output.
Regression in c76d87427d70f6c91ab855ed688828aa982720d2.
This commit is contained in:
parent
bb79e480e1
commit
a170dac887
@ -273,7 +273,7 @@ class Command(BaseCommand):
|
|||||||
if params['unique']:
|
if params['unique']:
|
||||||
columns = params['columns']
|
columns = params['columns']
|
||||||
if len(columns) > 1:
|
if len(columns) > 1:
|
||||||
unique_together.append('(' + str(tuple(column_to_field_name[c] for c in columns)) + ')')
|
unique_together.append(str(tuple(column_to_field_name[c] for c in columns)))
|
||||||
managed_comment = " # Created from a view. Don't remove." if is_view else ""
|
managed_comment = " # Created from a view. Don't remove." if is_view else ""
|
||||||
meta = ["",
|
meta = ["",
|
||||||
" class Meta:",
|
" class Meta:",
|
||||||
|
@ -211,6 +211,7 @@ class InspectDBTestCase(TestCase):
|
|||||||
out = StringIO()
|
out = StringIO()
|
||||||
call_command('inspectdb', 'inspectdb_uniquetogether', stdout=out)
|
call_command('inspectdb', 'inspectdb_uniquetogether', stdout=out)
|
||||||
output = out.getvalue()
|
output = out.getvalue()
|
||||||
|
self.assertIn(" unique_together = (('", output)
|
||||||
unique_re = re.compile(r'.*unique_together = \((.+),\).*')
|
unique_re = re.compile(r'.*unique_together = \((.+),\).*')
|
||||||
unique_together_match = re.findall(unique_re, output)
|
unique_together_match = re.findall(unique_re, output)
|
||||||
# There should be one unique_together tuple.
|
# There should be one unique_together tuple.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user