django-carton 1.2.0

django-carton is a simple and lightweight application for shopping carts and wish lists.
  +------+
 /|     /|
+-+----+ |    django-carton helps you build your shopping
| |    | |    cart and which list functionality.
| +----+-+
|/     |/
+------+
  • It's simple: You decide how to implement the views, templates and payment processing.
  • It's lightweight: The cart lives in the session.
  • It's just a container: You define your product model the way you want.

Usage Example

View:

from django.http import HttpResponse

from carton.cart import Cart
from products.models import Product

def add(request):
    cart = Cart(request.session)
    product = Product.objects.get(id=request.GET.get('product_id'))
    cart.add(product, price=product.price)
    return HttpResponse("Added")

def show(request):
    return render(request, 'shopping/show-cart.html')

We are assuming here that your products are defined in an application called products.

Template:

{% load carton_tags %}
{% get_cart as cart %}

{% for item in cart.items %}
    {{ item.product.name }}
    {{ item.quantity }}
    {{ item.total_price }}
{% endfor %}

You can also use this convinent shortcut:
{% for product in cart.products %}
    {{ product.name }}
{% endfor %}
Creative Commons Attribution 3.0 Unported

Author

lazybird

Pip

django-carton==1.2.0

Classifiers

  • Development Status :: 5 - Production/Stable
  • Environment :: Web Environment
  • Framework :: Django
  • Programming Language :: Python
  • Topic :: Software Development :: Libraries :: Python Modules
File Type Python Version Uploaded On Downloads
django-carton-1.2.0.tar.gz Source June 19, 2014 4,051
Version Release Date
1.2.0 June 19, 2014
1.1.3 March 22, 2014
1.1.2 Feb. 13, 2014
1.1.0 Feb. 12, 2014
1.0.2 Jan. 9, 2014
1.0.1 Nov. 7, 2013
1.0.0 Nov. 7, 2013
Date Package Version Action
Aug. 24, 2015, 10:59 p.m. django-carton 1.2.0 Release Created
Aug. 24, 2015, 10:59 p.m. django-carton 1.0.2 Release Created
Aug. 24, 2015, 10:59 p.m. django-carton 1.0.1 Release Created
Aug. 24, 2015, 10:59 p.m. django-carton 1.0.0 Release Created
Aug. 24, 2015, 10:59 p.m. django-carton 1.1.2 Release Created
Aug. 24, 2015, 10:59 p.m. django-carton 1.1.3 Release Created
Aug. 24, 2015, 10:59 p.m. django-carton 1.1.0 Release Created
Aug. 24, 2015, 10:59 p.m. django-carton Package Created