From 5f4cc52ef5c0f603420c6ea809594710a372d336 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 9 Oct 2014 10:11:44 +0100 Subject: [PATCH] Tweaking --- rest_framework/validators.py | 6 ++++++ tests/test_validators.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rest_framework/validators.py b/rest_framework/validators.py index 5bb69ad88..f76faaa4b 100644 --- a/rest_framework/validators.py +++ b/rest_framework/validators.py @@ -12,6 +12,9 @@ from rest_framework.utils.representation import smart_repr class UniqueValidator: + """ + Validator that corresponds to `unique=True` on a model field. + """ # Validators with `requires_context` will have the field instance # passed to them when the field is instantiated. requires_context = True @@ -46,6 +49,9 @@ class UniqueValidator: class UniqueTogetherValidator: + """ + Validator that corresponds to `unique_together = (...)` on a model class. + """ requires_context = True message = _('The fields {field_names} must make a unique set.') diff --git a/tests/test_validators.py b/tests/test_validators.py index ac04d2b4c..1d0814115 100644 --- a/tests/test_validators.py +++ b/tests/test_validators.py @@ -131,7 +131,7 @@ class TestUniquenessTogetherValidation(TestCase): 'position': 1 } - def test_ignore_exlcuded_fields(self): + def test_ignore_excluded_fields(self): """ When model fields are not included in a serializer, then uniqueness validtors should not be added for that field.