Tightened up some code in django.core.validators
git-svn-id: http://code.djangoproject.com/svn/django/trunk@404 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
0c6019295a
commit
63eecadfc6
|
@ -211,9 +211,8 @@ class AlwaysMatchesOtherField:
|
||||||
raise ValidationError, self.error_message
|
raise ValidationError, self.error_message
|
||||||
|
|
||||||
class RequiredIfOtherFieldNotGiven:
|
class RequiredIfOtherFieldNotGiven:
|
||||||
def __init__(self, other_field_name, error_message=None):
|
def __init__(self, other_field_name, error_message="Please enter something for at least one field."):
|
||||||
self.other = other_field_name
|
self.other, self.error_message = other_field_name, error_message
|
||||||
self.error_message = error_message or "Please enter something for at least one field."
|
|
||||||
self.always_test = True
|
self.always_test = True
|
||||||
|
|
||||||
def __call__(self, field_data, all_data):
|
def __call__(self, field_data, all_data):
|
||||||
|
@ -222,8 +221,7 @@ class RequiredIfOtherFieldNotGiven:
|
||||||
|
|
||||||
class RequiredIfOtherFieldsGiven:
|
class RequiredIfOtherFieldsGiven:
|
||||||
def __init__(self, other_field_names, error_message="Please enter both fields or leave them both empty."):
|
def __init__(self, other_field_names, error_message="Please enter both fields or leave them both empty."):
|
||||||
self.other = other_field_names
|
self.other, self.error_message = other_field_names, error_message
|
||||||
self.error_message = error_message
|
|
||||||
self.always_test = True
|
self.always_test = True
|
||||||
|
|
||||||
def __call__(self, field_data, all_data):
|
def __call__(self, field_data, all_data):
|
||||||
|
|
Loading…
Reference in New Issue