Skip to content

Commit

Permalink
Modified sale line serialization for cart #7211
Browse files Browse the repository at this point in the history
By default, the standard fields 'display_name', 'url', 'image' are
picked from the sale line's product. In downstream modules this
behaviour can be modified.
  • Loading branch information
PritishC committed Mar 4, 2015
1 parent 8bf3052 commit 0e02378
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ def serialize(self, purpose=None):
if purpose == 'cart':
res.update({
'id': self.id,
'display_name': self.description or self.product.name,
'url': self.product.get_absolute_url(_external=True),
'image': (
self.product.default_image.transform_command().thumbnail(
150, 150, 'a'
).url() if self.product.default_image else None
),
'product': self.product.serialize(purpose),
'quantity': number_format(self.quantity),
'unit': self.unit.symbol,
Expand Down

0 comments on commit 0e02378

Please sign in to comment.