fix distribution delete bug, in signals
This commit is contained in:
@@ -51,7 +51,13 @@ def update_quota_remaining(sender, instance, **kwargs):
|
||||
# if _from_signal=True prevent from maximum recursion loop
|
||||
if getattr(instance, '_from_signal', False):
|
||||
return
|
||||
remaining_distribution_weight(instance)
|
||||
|
||||
# when delete object, prevent from update fields error
|
||||
if kwargs.get('signal') == post_delete:
|
||||
if instance.parent_distribution:
|
||||
remaining_distribution_weight(instance.parent_distribution)
|
||||
else:
|
||||
remaining_distribution_weight(instance)
|
||||
|
||||
|
||||
def update_product_stats(instance: Product):
|
||||
|
||||
Reference in New Issue
Block a user