Return UniquenessTogetherModel to previous state

This commit is contained in:
Aider Ibragimov 2015-02-19 18:09:04 +03:00
parent fe8d95f93e
commit aa7ed316d8

View File

@ -76,8 +76,8 @@ class TestUniquenessValidation(TestCase):
# ----------------------------------- # -----------------------------------
class UniquenessTogetherModel(models.Model): class UniquenessTogetherModel(models.Model):
race_name = models.CharField(max_length=100, null=True) race_name = models.CharField(max_length=100)
position = models.IntegerField(null=True) position = models.IntegerField()
class Meta: class Meta:
unique_together = ('race_name', 'position') unique_together = ('race_name', 'position')
@ -134,8 +134,8 @@ class TestUniquenessTogetherValidation(TestCase):
expected = dedent(""" expected = dedent("""
UniquenessTogetherSerializer(): UniquenessTogetherSerializer():
id = IntegerField(label='ID', read_only=True) id = IntegerField(label='ID', read_only=True)
race_name = CharField(allow_null=True, max_length=100, required=True) race_name = CharField(max_length=100, required=True)
position = IntegerField(allow_null=True, required=True) position = IntegerField(required=True)
class Meta: class Meta:
validators = [<UniqueTogetherValidator(queryset=UniquenessTogetherModel.objects.all(), fields=('race_name', 'position'))>] validators = [<UniqueTogetherValidator(queryset=UniquenessTogetherModel.objects.all(), fields=('race_name', 'position'))>]
""") """)
@ -204,7 +204,7 @@ class TestUniquenessTogetherValidation(TestCase):
expected = dedent(""" expected = dedent("""
ExcludedFieldSerializer(): ExcludedFieldSerializer():
id = IntegerField(label='ID', read_only=True) id = IntegerField(label='ID', read_only=True)
race_name = CharField(allow_null=True, max_length=100, required=False) race_name = CharField(max_length=100)
""") """)
assert repr(serializer) == expected assert repr(serializer) == expected