mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-21 09:58:23 +02:00
Use a signal to prevent a user that the note balance is negative
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
|
||||
from django.apps import AppConfig
|
||||
from django.conf import settings
|
||||
from django.db.models.signals import post_save, pre_delete
|
||||
from django.db.models.signals import pre_delete, pre_save, post_save
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from . import signals
|
||||
@ -17,6 +17,15 @@ class NoteConfig(AppConfig):
|
||||
"""
|
||||
Define app internal signals to interact with other apps
|
||||
"""
|
||||
pre_save.connect(
|
||||
signals.pre_save_note,
|
||||
sender="note.noteuser",
|
||||
)
|
||||
pre_save.connect(
|
||||
signals.pre_save_note,
|
||||
sender="note.noteclub",
|
||||
)
|
||||
|
||||
post_save.connect(
|
||||
signals.save_user_note,
|
||||
sender=settings.AUTH_USER_MODEL,
|
||||
|
Reference in New Issue
Block a user