mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-22 18:38:23 +02:00
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:
@ -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()
|
||||
|
Reference in New Issue
Block a user