Commits

Anonymous committed ab6d359

Fixed #2 Use pk instead of id

Comments (0)

Files changed (1)

session_cart/cart.py

     def save(self):
         '''Save this cart to the session'''
         self.request.session[self.key] = tuple(
-            (i.item.id, i.quantity,)
+            (i.item.pk, i.quantity,)
             for i in self
         )
 
     def add_item(self, item, quantity =1):
         '''Add a new item to this session'''
         if not isinstance(item, self.model):
-            item = self.model.objects.get(id=item)
+            item = self.model.objects.get(pk=item)
         # Dupe checking
         try:
             self[self.index(item)].quantity += quantity