Skip to content

Commit

Permalink
fix: save cart instance before iterating
Browse files Browse the repository at this point in the history
  • Loading branch information
henri-hulski committed Sep 19, 2022
1 parent 1c0f0cd commit b10edca
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions cartridge/shop/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ def __iter__(self):
ensuring the items are only retrieved once and cached.
"""
if not hasattr(self, "_cached_items"):
self.save()
self._cached_items = self.items.all()
return iter(self._cached_items)

Expand Down

0 comments on commit b10edca

Please sign in to comment.