Use pre_delete signal insted of Model.delete() to prevent note balance issues when deleting a transaction (don't do it) in Django Admin
This commit is contained in:
parent
cc5996121b
commit
1023c6c502
3 changed files with 14 additions and 9 deletions
|
|
@ -24,3 +24,11 @@ def save_club_note(instance, raw, **_kwargs):
|
|||
from .models import NoteClub
|
||||
NoteClub.objects.get_or_create(club=instance)
|
||||
instance.note.save()
|
||||
|
||||
|
||||
def delete_transaction(instance, **_kwargs):
|
||||
"""
|
||||
Whenever we want to delete a transaction (caution with this), we ensure the transaction is invalid first.
|
||||
"""
|
||||
instance.valid = False
|
||||
instance.save()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue