Skip to content

Commit

Permalink
Merge pull request #118 from django-oscar/feature/attribute-code
Browse files Browse the repository at this point in the history
Added attribute code, because that is the prefered name for referring…
  • Loading branch information
Martijn Jacobs committed Apr 4, 2018
2 parents f702856 + cfebcaf commit 75809ad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions oscarapi/serializers/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class Meta:


class ProductAttributeValueSerializer(OscarModelSerializer):
name = serializers.StringRelatedField(source="attribute")
name = serializers.CharField(source="attribute.name")
code = serializers.CharField(source="attribute.code")
value = serializers.SerializerMethodField()

def get_value(self, obj):
Expand Down Expand Up @@ -65,7 +66,7 @@ class Meta:
model = ProductAttributeValue
fields = overridable(
'OSCARAPI_PRODUCT_ATTRIBUTE_VALUE_FIELDS',
default=('name', 'value'))
default=('name', 'value', 'code'))


class ProductAttributeSerializer(OscarModelSerializer):
Expand Down

0 comments on commit 75809ad

Please sign in to comment.