Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency between product class and product category #340

Open
JulienPalard opened this issue Apr 2, 2024 · 1 comment
Open

Inconsistency between product class and product category #340

JulienPalard opened this issue Apr 2, 2024 · 1 comment

Comments

@JulienPalard
Copy link
Contributor

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?

@JulienPalard
Copy link
Contributor Author

Maybe this need a discussion, maybe there's already a consensus on this, but should the API expose slugs or names?

My gut feeling is that it should expose names, as I prefer the i18n to happen server side than client side, but this argument does not weight much...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant