diff --git a/tests/regressiontests/serializers_regress/models.py b/tests/regressiontests/serializers_regress/models.py index 4e740b4b63..fea5c94cab 100644 --- a/tests/regressiontests/serializers_regress/models.py +++ b/tests/regressiontests/serializers_regress/models.py @@ -100,6 +100,12 @@ class Anchor(models.Model): something for other models to point at""" data = models.CharField(maxlength=30) + +class UniqueAnchor(models.Model): + """This is a model that can be used as + something for other models to point at""" + + data = models.CharField(unique=True, maxlength=30) class FKData(models.Model): data = models.ForeignKey(Anchor, null=True) @@ -117,12 +123,6 @@ class M2MSelfData(models.Model): data = models.ManyToManyField('self', null=True, symmetrical=False) -class UniqueAnchor(models.Model): - """This is a model that can be used as - something for other models to point at""" - - data = models.CharField(unique=True, maxlength=30) - class FKDataToField(models.Model): data = models.ForeignKey(UniqueAnchor, null=True, to_field='data') diff --git a/tests/regressiontests/serializers_regress/tests.py b/tests/regressiontests/serializers_regress/tests.py index fdd464f1b4..317739dac4 100644 --- a/tests/regressiontests/serializers_regress/tests.py +++ b/tests/regressiontests/serializers_regress/tests.py @@ -159,6 +159,7 @@ The end."""), (data_obj, 300, Anchor, "Anchor 1"), (data_obj, 301, Anchor, "Anchor 2"), + (data_obj, 302, UniqueAnchor, "UAnchor 1"), (fk_obj, 400, FKData, 300), # Post reference (fk_obj, 401, FKData, 500), # Pre reference @@ -184,14 +185,13 @@ The end."""), (m2m_obj, 445, M2MSelfData, []), (m2m_obj, 446, M2MSelfData, []), - (data_obj, 450, UniqueAnchor, "UAnchor 1"), - (fk_obj, 451, FKDataToField, "UAnchor 1"), - (fk_obj, 452, FKDataToField, "UAnchor 2"), - (fk_obj, 453, FKDataToField, None), - (data_obj, 454, UniqueAnchor, "UAnchor 2"), + (fk_obj, 450, FKDataToField, "UAnchor 1"), + (fk_obj, 451, FKDataToField, "UAnchor 2"), + (fk_obj, 452, FKDataToField, None), (data_obj, 500, Anchor, "Anchor 3"), (data_obj, 501, Anchor, "Anchor 4"), + (data_obj, 502, UniqueAnchor, "UAnchor 2"), (pk_obj, 601, BooleanPKData, True), (pk_obj, 602, BooleanPKData, False),