Ajax utilities for django SHOP
Project description
=================================
django SHOP - Ajax
=================================
This app adds some nifty ajax functions you can use with django SHOP.
Installation
============
This requires jQuery (http://jquery.com/) and django SHOP to work (https://github.com/chrisglass/django-shop)
* Add ``shop_ajax`` to your ``INSTALLED_APPS`` in your settings.py
* On your server run `python manage.py collectstatic` to collect all app's static files
Alternatively, you can just copy the content of shop.js in your javascript files.
Usage
=====
* Import the javascript files
::
<script type="text/javascript" src="{{ STATIC_URL }}shop_ajax/shop.js"></script>
* Initialize the SHOP.cart somewhere on the top of your javascript code by providing it a `csrf_token` and urls to corresponding views
::
SHOP.cart.init('{{ csrf_token }}', '{% url cart_item_add %}', '{% url cart_item_add %}', '{% url cart_delete %}');
* Use the provided functions in your templates
::
<a href="#" onclick="SHOP.cart.addItem({{ product.id }})">Add to cart</a>
...
django SHOP - Ajax
=================================
This app adds some nifty ajax functions you can use with django SHOP.
Installation
============
This requires jQuery (http://jquery.com/) and django SHOP to work (https://github.com/chrisglass/django-shop)
* Add ``shop_ajax`` to your ``INSTALLED_APPS`` in your settings.py
* On your server run `python manage.py collectstatic` to collect all app's static files
Alternatively, you can just copy the content of shop.js in your javascript files.
Usage
=====
* Import the javascript files
::
<script type="text/javascript" src="{{ STATIC_URL }}shop_ajax/shop.js"></script>
* Initialize the SHOP.cart somewhere on the top of your javascript code by providing it a `csrf_token` and urls to corresponding views
::
SHOP.cart.init('{{ csrf_token }}', '{% url cart_item_add %}', '{% url cart_item_add %}', '{% url cart_delete %}');
* Use the provided functions in your templates
::
<a href="#" onclick="SHOP.cart.addItem({{ product.id }})">Add to cart</a>
...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-shop-ajax-0.1.2.tar.gz
.
File metadata
- Download URL: django-shop-ajax-0.1.2.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 193608401d03c4a6c4bb1c8ccf639c430388d837fafd46af5ac631f6fa572d03 |
|
MD5 | 7f213e48363c8abeef7c058ac26bb6e8 |
|
BLAKE2b-256 | 2a1f2cd34869a9ec26ae8e0ae128e7ebf7885f6f8dfea95c5d6fbd614f2a38e8 |