mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Use the tablename when generating automatic model events
This commit is contained in:
parent
972cff493e
commit
f1d8bf71b7
@ -163,17 +163,15 @@ def after_save(sender, instance, created, **kwargs):
|
|||||||
|
|
||||||
if created:
|
if created:
|
||||||
trigger_event(
|
trigger_event(
|
||||||
'instance.created',
|
f'{table}.created',
|
||||||
id=instance.id,
|
id=instance.id,
|
||||||
model=sender.__name__,
|
model=sender.__name__,
|
||||||
table=table,
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
trigger_event(
|
trigger_event(
|
||||||
'instance.saved',
|
f'{table}.saved',
|
||||||
id=instance.id,
|
id=instance.id,
|
||||||
model=sender.__name__,
|
model=sender.__name__,
|
||||||
table=table,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -189,9 +187,8 @@ def after_delete(sender, instance, **kwargs):
|
|||||||
return
|
return
|
||||||
|
|
||||||
trigger_event(
|
trigger_event(
|
||||||
'instance.deleted',
|
f'{table}.deleted',
|
||||||
model=sender.__name__,
|
model=sender.__name__,
|
||||||
table=table,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user