Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
try:
attr_id = items['item']['attr_id']
attribute = Attribute.objects.get(productid=prods.id,id=attr_id)
total_order += attribute.unit_price * int(quantity)
items[item]['price'] = attribute.unit_price
except Attribute.DoesNotExist:
total_order += prods.price * int(quantity)
items[item]['price'] = prods.price
except TypeError:
attr_id = items['item']['attr_id']
attribute = Attribute.objects.get(productid=prods.id,id=attr_id)
items['attribute'] = attribute.label+attribute.value+attribute+unit
total_order += prods.price * int(quantity)
items[item]['price'] = prods.price
finally :
total_order += prods.price * int(quantity)
items[item]['price'] = prods.price
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment