mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 00:04:16 +03:00
Return UniquenessTogetherModel to previous state
This commit is contained in:
parent
fe8d95f93e
commit
aa7ed316d8
|
@ -76,8 +76,8 @@ class TestUniquenessValidation(TestCase):
|
|||
# -----------------------------------
|
||||
|
||||
class UniquenessTogetherModel(models.Model):
|
||||
race_name = models.CharField(max_length=100, null=True)
|
||||
position = models.IntegerField(null=True)
|
||||
race_name = models.CharField(max_length=100)
|
||||
position = models.IntegerField()
|
||||
|
||||
class Meta:
|
||||
unique_together = ('race_name', 'position')
|
||||
|
@ -134,8 +134,8 @@ class TestUniquenessTogetherValidation(TestCase):
|
|||
expected = dedent("""
|
||||
UniquenessTogetherSerializer():
|
||||
id = IntegerField(label='ID', read_only=True)
|
||||
race_name = CharField(allow_null=True, max_length=100, required=True)
|
||||
position = IntegerField(allow_null=True, required=True)
|
||||
race_name = CharField(max_length=100, required=True)
|
||||
position = IntegerField(required=True)
|
||||
class Meta:
|
||||
validators = [<UniqueTogetherValidator(queryset=UniquenessTogetherModel.objects.all(), fields=('race_name', 'position'))>]
|
||||
""")
|
||||
|
@ -204,7 +204,7 @@ class TestUniquenessTogetherValidation(TestCase):
|
|||
expected = dedent("""
|
||||
ExcludedFieldSerializer():
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user