Oscar API Settings

Main settings


Default: True

Useful in production websites where you want to make sure that the admin api is not exposed at all.


Default: False

The Login view (GET) and the owner field in the BasketSerializer and CheckoutSerializer expose user details, like username and email address. With this setting you can enable/disable this behaviour.


Default: False

Enables the register endpoint so it’s possible to create new user accounts.



    "User-Agent": "django-oscar-api/<version>"

Changes the headers for the admin api when downloading images.

Serializer settings

Most of the model serializers in Oscar API have a default set of fields to use in the REST API. If you customized the Oscar models you can reflect this customization by adding settings for this serializer.

For example, the RecommendedProduct serializer is defined as following:

class RecommmendedProductSerializer(OscarModelSerializer):
    url = serializers.HyperlinkedIdentityField(view_name='product-detail')

    class Meta:
        model = Product
        fields = overridable(

When you add the following section to your settings.py you will add the ‘title’ field as well:


The following serializers have customizable field settings:

Basket serializers

class oscarapi.serializers.basket.BasketSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]
class oscarapi.serializers.basket.BasketLineSerializer(*args, **kwargs)[source]

This serializer computes the prices of this line by using the basket strategy.

class oscarapi.serializers.basket.VoucherSerializer(*args, **kwargs)[source]

Checkout serializers

class oscarapi.serializers.checkout.OrderSerializer(*args, **kwargs)[source]

The order serializer tries to have the same kind of structure as the basket. That way the same kind of logic can be used to display the order as the basket in the checkout process.

class oscarapi.serializers.checkout.OrderLineSerializer(*args, **kwargs)[source]

This serializer renames some fields so they match up with the basket

class oscarapi.serializers.checkout.InlineSurchargeSerializer(*args, **kwargs)[source]
class oscarapi.serializers.checkout.UserAddressSerializer(*args, **kwargs)[source]

Login serializers

class oscarapi.serializers.login.UserSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Product serializers

class oscarapi.serializers.product.OptionSerializer(*args, **kwargs)[source]
class oscarapi.serializers.product.ProductLinkSerializer(*args, **kwargs)[source]

Summary serializer for list view, listing all products.

This serializer can be easily made to show any field on ProductSerializer, just add fields to the OSCARAPI_PRODUCT_FIELDS setting.

class oscarapi.serializers.product.RecommmendedProductSerializer(*args, **kwargs)[source]
class oscarapi.serializers.product.ChildProductSerializer(*args, **kwargs)[source]

Serializer for child products

class oscarapi.serializers.product.ProductSerializer(*args, **kwargs)[source]

Serializer for public api with strategy fields added for price and availability

class oscarapi.serializers.product.ProductAttributeSerializer(*args, **kwargs)[source]
class oscarapi.serializers.product.ProductAttributeValueSerializer(*args, **kwargs)[source]