add __str__ method for Order model

This commit is contained in:
Thomas Steen Rasmussen 2016-05-30 17:32:53 +02:00
parent e74783162f
commit 3e80c51572

View file

@ -69,6 +69,9 @@ class Order(CreatedUpdatedModel):
default=BLOCKCHAIN default=BLOCKCHAIN
) )
def __str__(self):
return 'order id #%s' % self.pk
def get_number_of_items(self): def get_number_of_items(self):
return self.products.aggregate( return self.products.aggregate(
sum=Sum('orderproductrelation__quantity') sum=Sum('orderproductrelation__quantity')