Open JulienPalard opened 6 months ago
When creating a product in the sandbox (in current main branch):
main
$ curl --user mdk:supersecret -XPOST http://localhost:8000/api/admin/products/ -H "Content-Type: application/json" -d '{"product_class": "testtype", "slug": "test", "attributes": [{"code": "text", "value": "1"}]}'
it works, but when I use an empty value, like:
$ curl --user mdk:supersecret -XPOST http://localhost:8000/api/admin/products/ -H "Content-Type: application/json" -d '{"product_class": "testtype", "slug": "test", "attributes": [{"code": "text", "value": ""}]}'
I'm getting a 500 error.
It looks like it's due to the ProductAttributeValueSerializer's update_or_create method doing:
ProductAttributeValueSerializer
attribute.save_value(product, value) return product.attribute_values.get(attribute=attribute)
the save may not save empty values (which looks OK to me) so the following get fails.
get
When creating a product in the sandbox (in current
main
branch):it works, but when I use an empty value, like:
I'm getting a 500 error.
It looks like it's due to the
ProductAttributeValueSerializer
's update_or_create method doing:the save may not save empty values (which looks OK to me) so the following
get
fails.