django-carton is a simple and lightweight application for shopping carts and wish lists.
Project description
+------+ /| /| +-+----+ | 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 %}
Documentation
Read more: https://github.com/lazybird/django-carton/
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-carton-1.1.3.tar.gz
(7.2 kB
view details)
File details
Details for the file django-carton-1.1.3.tar.gz
.
File metadata
- Download URL: django-carton-1.1.3.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd9f16bbcf61b0736fcb1c6a4ac58eb4a10f54e7d9ba6e7bbc39dfb25499fae0 |
|
MD5 | a5442b146bb4ce1947498462f834eb8c |
|
BLAKE2b-256 | 4e672a75bf2b45f5e9fdf676eb2d6f3ab8f0540c77a126251b4ea3c4a1ec9a36 |