wagtail-longclaw/docs/walkthrough/basket.rst

21 wiersze
767 B
ReStructuredText
Czysty Zwykły widok Historia

2017-03-30 20:52:59 +00:00
.. _walkthrough-basket:
2017-04-05 13:48:49 +00:00
Displaying the Basket
2017-04-06 21:49:58 +00:00
=====================
Longclaw provides a REST API endpoint for retrieving basket data and a django view.
To use the django view, we must provide a template titled ``longclawbasket/basket.html``.
It is common to provide a link to the basket page in the header. We can use the ``url`` tag in
our site header to provide the link::
{% url 'longclaw-basket' %}
In the basket template, we have access to all basket items under the ``basket`` context::
{% for item in basket %}
...
{% endfor %}
For the full implementation of the basket template, take a look at the `longclaw demo repository <https://github.com/JamesRamm/longclaw_demo/blob/master/longclaw_demo/templates/longclawbasket/basket.html>`_