Skip to content

Commit f00f7b1

Browse files
committed
fix: correct write_only_fields to extra_kwargs for sign_up_type
1 parent 0a1ea10 commit f00f7b1

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

api/custom_auth/serializers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@ class Meta(UserCreateSerializer.Meta): # type: ignore[misc]
6363
"is_active",
6464
"marketing_consent_given",
6565
"uuid",
66+
"sign_up_type",
6667
)
6768
read_only_fields = ("is_active", "uuid", "marketing_consent_given")
68-
write_only_fields = ("sign_up_type",)
6969
extra_kwargs = {
70+
"sign_up_type": {"write_only": True, "required": False},
7071
"email": {
7172
"validators": [
7273
UniqueValidator(
@@ -75,7 +76,7 @@ class Meta(UserCreateSerializer.Meta): # type: ignore[misc]
7576
message="Email already exists. Please log in.",
7677
)
7778
]
78-
}
79+
},
7980
}
8081

8182
def validate(self, attrs): # type: ignore[no-untyped-def]

api/tests/integration/custom_auth/end_to_end/test_custom_auth_integration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ def test_register__with_sign_up_type__stores_sign_up_type(client, db): # type:
641641
)
642642

643643
# Then
644+
print(response.content)
644645
assert response.status_code == status.HTTP_201_CREATED
645646

646647
response_json = response.json()

0 commit comments

Comments
 (0)