I'm struggling to try and figure out why a post_save function is returning:
Exception Type: RuntimeError
Exception Value: maximum recursion depth exceeded
Here is my code:
#post save functions of the order
def orderPs(sender, instance=False, **kwargs):
if instance.reference is None:
instance.reference = str(friendly_id.encode(instance.id))
#now update the amounts from the order items
total = 0
tax = 0
#oi = OrderItem.objects.filter(order=instance)
#for i in oi.all():
# total += i.total
# tax += i.total_tax
instance.total = total
instance.tax = tax
instance.save()
#connect signal
post_save.connect(orderPs, sender=Order)
I've commented out the order items code for now.
instance.total and instance.tax are model decimal fields.
It seems like the post_save function is in an endless loop, not sure why as I've used the same format for all of my post_save functions.
Any ideas?