Fixed #21469 -- Allow set objects in Meta.unique_together.

Thanks to Tim for the review.
This commit is contained in:
Baptiste Mispelon 2013-11-20 10:28:22 +01:00
parent 4cfe6ba6a3
commit 331d79a77d
2 changed files with 36 additions and 1 deletions

View file

@ -32,6 +32,7 @@ def normalize_unique_together(unique_together):
tuple of two strings. Normalize it to a tuple of tuples, so that
calling code can uniformly expect that.
"""
unique_together = tuple(unique_together)
if unique_together and not isinstance(unique_together[0], (tuple, list)):
unique_together = (unique_together,)
return unique_together