Use the tablename when generating automatic model events

This commit is contained in:
Oliver Walters 2022-05-03 10:18:11 +10:00
parent 972cff493e
commit f1d8bf71b7

View File

@ -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,
) )