Skip to content

Commit

Permalink
Added documentation about settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Martijn Jacobs committed Dec 28, 2015
1 parent 7936e6a commit a6f5512
Showing 1 changed file with 65 additions and 2 deletions.
67 changes: 65 additions & 2 deletions docs/source/usage/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,69 @@
Oscar API Settings
==================

.. attention::
List all settings specific to Oscar Api and describe them here.
Main settings
=============

``OSCARAPI_BLOCK_ADMIN_API_ACCESS``
-----------------------------------
Default: ``True``

Useful in production websites wehere you want to make sure that admin users
can't access the API (they can read/write anything which is exposed by the API)


Serializer settings
===================

Most of the model serializers in Oscar API have a default set of fields to display/show 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:

.. code-block:: python
class RecommmendedProductSerializer(OscarModelSerializer):
url = serializers.HyperlinkedIdentityField(view_name='product-detail')
class Meta:
model = Product
fields = overridable(
'OSCARAPI_RECOMMENDED_PRODUCT_FIELDS',
default=('url',)
)
When you add the following section to your ``settings.py`` you will add the 'title' field as well:

.. code-block:: python
OSCARAPI_RECOMMENDED_PRODUCT_FIELDS = ('url', 'title')
The following serializers have customizable field settings:

Basket serializers
------------------

.. autoclass:: oscarapi.serializers.basket.BasketSerializer
.. autoclass:: oscarapi.serializers.basket.BasketLineSerializer
.. autoclass:: oscarapi.serializers.basket.VoucherSerializer

Checkout serializers
--------------------

.. autoclass:: oscarapi.serializers.checkout.OrderSerializer
.. autoclass:: oscarapi.serializers.checkout.OrderLineSerializer

Login serializers
-----------------

.. autoclass:: oscarapi.serializers.login.UserSerializer

Product serializers
-------------------

.. autoclass:: oscarapi.serializers.product.OptionSerializer
.. autoclass:: oscarapi.serializers.product.ProductLinkSerializer
.. autoclass:: oscarapi.serializers.product.RecommmendedProductSerializer
.. autoclass:: oscarapi.serializers.product.ProductSerializer


0 comments on commit a6f5512

Please sign in to comment.