Catch RelatedObjectDoesNotExist error

This commit is contained in:
Raphael Michel
2016-02-22 13:55:06 +01:00
parent 14e5134890
commit 0fd519df4d

View File

@@ -214,9 +214,9 @@ class OrderModify(EventViewMixin, OrderDetailMixin, QuestionsViewMixin, Template
@cached_property @cached_property
def invoice_address(self): def invoice_address(self):
if self.order.invoice_address: try:
return self.order.invoice_address return self.order.invoice_address
else: except InvoiceAddress.DoesNotExist:
return InvoiceAddress(order=self.order) return InvoiceAddress(order=self.order)
@cached_property @cached_property