Skip to content

Commit 7d64b70

Browse files
chickahoonacarltongibson
authored andcommitted
Removed input value from deault_error_message (#5881)
1 parent 4260531 commit 7d64b70

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

rest_framework/fields.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ def __repr__(self):
642642

643643
class BooleanField(Field):
644644
default_error_messages = {
645-
'invalid': _('"{input}" is not a valid boolean.')
645+
'invalid': _('Must be a valid boolean.')
646646
}
647647
default_empty_html = False
648648
initial = False
@@ -687,7 +687,7 @@ def to_representation(self, value):
687687

688688
class NullBooleanField(Field):
689689
default_error_messages = {
690-
'invalid': _('"{input}" is not a valid boolean.')
690+
'invalid': _('Must be a valid boolean.')
691691
}
692692
initial = None
693693
TRUE_VALUES = {
@@ -841,7 +841,7 @@ class UUIDField(Field):
841841
valid_formats = ('hex_verbose', 'hex', 'int', 'urn')
842842

843843
default_error_messages = {
844-
'invalid': _('"{value}" is not a valid UUID.'),
844+
'invalid': _('Must be a valid UUID.'),
845845
}
846846

847847
def __init__(self, **kwargs):

tests/test_fields.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ class TestBooleanField(FieldValues):
629629
False: False,
630630
}
631631
invalid_inputs = {
632-
'foo': ['"foo" is not a valid boolean.'],
632+
'foo': ['Must be a valid boolean.'],
633633
None: ['This field may not be null.']
634634
}
635635
outputs = {
@@ -654,7 +654,7 @@ def test_disallow_unhashable_collection_types(self):
654654
for input_value in inputs:
655655
with pytest.raises(serializers.ValidationError) as exc_info:
656656
field.run_validation(input_value)
657-
expected = ['"{0}" is not a valid boolean.'.format(input_value)]
657+
expected = ['Must be a valid boolean.'.format(input_value)]
658658
assert exc_info.value.detail == expected
659659

660660

@@ -671,7 +671,7 @@ class TestNullBooleanField(TestBooleanField):
671671
None: None
672672
}
673673
invalid_inputs = {
674-
'foo': ['"foo" is not a valid boolean.'],
674+
'foo': ['Must be a valid boolean.'],
675675
}
676676
outputs = {
677677
'true': True,
@@ -815,8 +815,8 @@ class TestUUIDField(FieldValues):
815815
284758210125106368185219588917561929842: uuid.UUID('d63a6fb6-88d5-40c7-a91c-9edf73283072')
816816
}
817817
invalid_inputs = {
818-
'825d7aeb-05a9-45b5-a5b7': ['"825d7aeb-05a9-45b5-a5b7" is not a valid UUID.'],
819-
(1, 2, 3): ['"(1, 2, 3)" is not a valid UUID.']
818+
'825d7aeb-05a9-45b5-a5b7': ['Must be a valid UUID.'],
819+
(1, 2, 3): ['Must be a valid UUID.']
820820
}
821821
outputs = {
822822
uuid.UUID('825d7aeb-05a9-45b5-a5b7-05df87923cda'): '825d7aeb-05a9-45b5-a5b7-05df87923cda'

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy