Skip to content

Inconsistency between product class and product category #340

@JulienPalard

Description

@JulienPalard

Currently the product class is serialized as a slug while the product category is serialized as a name.

I patched my ProductSerializer as:

 class ProductSerializer(oscarapi.serializers.product.ProductSerializer):
    product_class = serializers.SlugRelatedField(
        slug_field="name",
        queryset=oscarapi.serializers.product.ProductClass.objects,
        allow_null=True,
    )

so both are exposed as names. I don't know if it's worth a PR as it may break current uses?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions