Index: management.py =================================================================== --- management.py (revisión: 5724) +++ management.py (copia de trabajo) @@ -1180,16 +1180,21 @@ pass # Check unique_together. + from types import ListType, TupleType for ut in opts.unique_together: - for field_name in ut: - try: - f = opts.get_field(field_name, many_to_many=True) - except models.FieldDoesNotExist: - e.add(opts, '"unique_together" refers to %s, a field that doesn\'t exist. Check your syntax.' % field_name) - else: - if isinstance(f.rel, models.ManyToManyRel): - e.add(opts, '"unique_together" refers to %s. ManyToManyFields are not supported in unique_together.' % f.name) - + ut_type = type(ut) + if ut_type == ListType or ut_type == TupleType: + for field_name in ut: + try: + f = opts.get_field(field_name, many_to_many=True) + except models.FieldDoesNotExist: + e.add(opts, '"unique_together" refers to %s, a field that doesn\'t exist. Check your syntax.' % field_name) + else: + if isinstance(f.rel, models.ManyToManyRel): + e.add(opts, '"unique_together" refers to %s. ManyToManyFields are not supported in unique_together.' % f.name) + else: + e.add(opts, '"unique_together" refers to %s, they must be tuples not strings in a tuple' % str(opts.unique_together)) + break return len(e.errors) def validate(outfile=sys.stdout, silent_success=False):