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

Add order model example to docs #37

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions docs/checkout_and_payment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ which accepts a list of dotted paths to :class:`salesman.checkout.payment.Paymen

.. raw:: html

<h3>1. Create payment method</h3>
<h3>1. Create swappable order model</h3>

It is recommended to configure and setup all Salesman models as swappable even if it's not necessary at the beginning. This will future-proof your application in case you wish to add it later. This has to be done before the initial migrations are created. See :ref:`swappable_models`.

.. literalinclude:: /../example/shop/models/order.py

.. raw:: html

<h3>2. Create payment method</h3>

First create your custom payment method. Payment methods are required to specify a ``label`` and
a unique ``identifier`` property on class. To enable payment for the basket you should also
Expand All @@ -23,7 +31,7 @@ override the :meth:`salesman.checkout.payment.PaymentMethod.basket_payment` meth

.. raw:: html

<h3>2. Register payment method</h3>
<h3>3. Register payment method</h3>

Then register your payment method in ``settings.py``:

Expand Down