OrderItem: repr to no longer show the product if it's deleted
This commit is contained in:
parent
3cf49c7634
commit
59afcab907
1 changed files with 4 additions and 1 deletions
|
@ -149,7 +149,10 @@ class OrderItem(db.Model):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return 'Order %d: %s wants %s' % (self.order_id or 0, self.get_name(), self.product.name or 'None')
|
product = None
|
||||||
|
if self.product:
|
||||||
|
product = self.product
|
||||||
|
return 'Order %d: %s wants %s' % (self.order_id or 0, self.get_name(), product.name or 'None')
|
||||||
|
|
||||||
def can_delete(self, order_id, user_id, name):
|
def can_delete(self, order_id, user_id, name):
|
||||||
if int(self.order_id) != int(order_id):
|
if int(self.order_id) != int(order_id):
|
||||||
|
|
Loading…
Reference in a new issue