2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 13:35:40 +00:00

Simplify event triggering

- add generic receivers for database actions
- exclude django_q tables, otherwise we get an infinite loop!

Ref: https://stackoverflow.com/questions/17507784/consolidating-multiple-post-save-signals-with-one-receiver/32230933#32230933
This commit is contained in:
Oliver
2022-01-10 17:24:53 +11:00
parent 4ddd6bc351
commit 886b1f1d72
6 changed files with 54 additions and 85 deletions

View File

@ -280,8 +280,6 @@ def before_delete_part_category(sender, instance, using, **kwargs):
child.parent = instance.parent
child.save()
trigger_event('category.deleted')
def rename_part_image(instance, filename):
""" Function for renaming a part image file
@ -2186,10 +2184,8 @@ def after_save_part(sender, instance: Part, created, **kwargs):
"""
if created:
trigger_event('part.created', part_id=instance.pk)
pass
else:
trigger_event('part.saved', part_id=instance.pk)
# Check part stock only if we are *updating* the part (not creating it)
# Run this check in the background