Skip to content

Commit 70b2ac5

Browse files
fix(business): Correct validation for UNIQUE promo updates
PATCH requests to update fields (like description or image_url) on promos with mode='UNIQUE' failed. The validator incorrectly required the `promo_unique` field to be present in the input data. This commit removes the erroneous check for `promo_unique` presence from the `PromoDetailSerializer.validate` method when handling updates for UNIQUE promos, allowing partial updates to proceed correctly.
1 parent a9d1f2f commit 70b2ac5

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

promo_code/business/serializers.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -534,15 +534,6 @@ def validate(self, data):
534534
)
535535

536536
elif mode == business_models.Promo.MODE_UNIQUE:
537-
if not promo_unique:
538-
raise rest_framework.serializers.ValidationError(
539-
{
540-
'promo_unique': (
541-
'This field is required for UNIQUE mode.'
542-
),
543-
},
544-
)
545-
546537
if promo_common is not None:
547538
raise rest_framework.serializers.ValidationError(
548539
{

0 commit comments

Comments
 (0)