lazybird / django-carton

A simple and lightweight application for shopping carts and wish lists.
Other
274 stars 101 forks source link

Doesn't work with django 1.6 out of the box #9

Closed sect2k closed 10 years ago

sect2k commented 10 years ago

Django 1.6 changed the default SESSION_SERIALIZER from PickleSerializer to JSONSerializer which causes <carton.cart.Cart object> is not JSON serializable error.

I've looked trough the code and it seems you are storing the cart (along with "products") directly in session, which is a bad practice as it can cause problems when serializing complex "product" models and other sorts of unexpected problems (I did something similar on one of my early django projects and it came back to bite me in the a**).

The solution is to save only the state in the session and the recreate the Cart object on initialization. Given that your code is quite neatly organized it should be trivial. I forked the code and will try to put something together.

Really liking the simplicity of your app BTW.

Cheers, Mitja

lazybird commented 10 years ago

The compatibility problem was fixed while addressing issue #10.