def compute_subtotal(self):
    lineitems = list(OrderLineItem.objects.filter(order=self.id))
    delivery_charge = Location.objects.get(id=str(self.location)).get_delivery_charge()
    lines = []
    for lineitem in lineitems:
        lines.append(lineitem.line_price)
    if (self.delivery == True):
        pre_sub = sum(lines)
        subtotal = (sum(lines) + delivery_charge)
        return subtotal
    else:
        return sum(lines)
def compute_subtotal(self):
    lineitems = list(OrderLineItem.objects.filter(order=self.id))
    delivery_charge = Location.objects.get(id=str(self.location)).get_delivery_charge()
    lines = []
    for lineitem in lineitems:
        lines.append(lineitem.line_price)
    if (self.delivery == True):
        pre_sub = sum(lines)
        subtotal = (sum(lines) + delivery_charge)
        return subtotal
    else:
        return sum(lines)