开发者

django shopping cart as a beginner

开发者 https://www.devze.com 2023-02-12 08:24 出处:网络
i\'m quite new to django and trying 开发者_高级运维to add a shopping cart to a simple webshop.

i'm quite new to django and trying 开发者_高级运维to add a shopping cart to a simple webshop. What I need is a simple cart that can be filled and presents its content, which is then sent to the vendor via email. So Satchmo might be too big for this task. Therefore i chose django-cart (http://code.google.com/p/django-cart/) which causes some problems now.

1. Is django-cart the right thing? Or are there any better approaches to this task?

2. As I am a beginner even django-cart makes me struggle. I used the view and the template of the django-cart-website, but writing a form that can be used to add products to the cart took me hours. I probably need help in understanding the general layout of a shopping cart and its integration into a website.

3. Two more specific questions: Is it possible to dynamically populate a formfield in a template (e.g. with {{ object.id }})? Is django-cart able to change (update) the contents of a cart?

I hope it's not too many questions at once.

Thanks in advance Jacques


1: Yes, I believe Satchmo is too heavy for this task. django-cart sounds like a good starting point as a beginner, although it is so extremely simple it might make sense to start from scratch. At the same time, it's so simple you can comprehend it and not be hindered by code you don't understand.

2: Any specific problems?
http://code.google.com/p/django-cart/ This one's first page documentation makes it seem really simple (which is a great feature). The source is only a few hundred lines total.

Feel free to ask any specific problems you might have and we'll help :)

3:

  1. My gut feeling is: yes, most anything is possible, but you will have to clarify a bit. What exactly do you want to do? Dynamically populate a formfield with {{ object.id }} isn't clear enough. You could create a form field with raw html from <input type="hidden" value="{{ object.id }}" />, or you could build your form to do something with object in your view.

  2. Yes, http://code.google.com/p/django-cart/source/browse/trunk/cart/cart.py -- look at the update function. Again though this system is so basic (that update function is 4 or 5 lines) that you can add anything you like to this cart without worry. When you run into a problem and can't solve it, ask again here and we'll help.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号