Skip to content

Commit

Permalink
Merge pull request #343 from crgwbr/fix_null_image_attrs
Browse files Browse the repository at this point in the history
Fixes handling of null product image attributes
  • Loading branch information
specialunderwear authored Apr 12, 2024
2 parents 2a9eca5 + d4f9994 commit c89783e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions oscarapi/serializers/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ def to_representation(self, value):
elif obj_type == value.attribute.MULTI_OPTION:
return value.value.values_list("option", flat=True)
elif obj_type in [value.attribute.FILE, value.attribute.IMAGE]:
if not value.value:
return None
url = value.value.url
request = self.context.get("request", None)
if request is not None:
Expand Down

0 comments on commit c89783e

Please sign in to comment.