Skip to content

Commit 320ba6a

Browse files
authored
Removing first and last name requirement for a PATCH request (#2998)
1 parent c618969 commit 320ba6a

File tree

2 files changed

+0
-6
lines changed

2 files changed

+0
-6
lines changed

users/serializers.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,12 @@ class LegalAddressSerializer(serializers.ModelSerializer):
102102

103103
def validate_first_name(self, value):
104104
"""Validates the first name of the user"""
105-
if value == "":
106-
raise serializers.ValidationError("First name cannot be blank") # noqa: EM101
107105
if value and not USER_GIVEN_NAME_RE.match(value):
108106
raise serializers.ValidationError("First name is not valid") # noqa: EM101
109107
return value
110108

111109
def validate_last_name(self, value):
112110
"""Validates the last name of the user"""
113-
if value == "":
114-
raise serializers.ValidationError("Last name cannot be blank") # noqa: EM101
115111
if value and not USER_GIVEN_NAME_RE.match(value):
116112
raise serializers.ValidationError("Last name is not valid") # noqa: EM101
117113
return value

users/serializers_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ def test_validate_legal_address(valid_address_dict):
3737
@pytest.mark.parametrize(
3838
"field,value,error", # noqa: PT006
3939
[
40-
["first_name", "", "First name cannot be blank"], # noqa: PT007
41-
["last_name", "", "Last name cannot be blank"], # noqa: PT007
4240
["country", "", "This field may not be blank."], # noqa: PT007
4341
["country", None, "This field may not be null."], # noqa: PT007
4442
],

0 commit comments

Comments
 (0)