Implement signals

This commit is contained in:
Alexandre Iooss 2019-07-19 15:00:44 +02:00
parent d957e643c9
commit 085cd90a7f
No known key found for this signature in database
GPG key ID: 6C79278F3FCDCC02
5 changed files with 111 additions and 22 deletions

View file

@ -3,9 +3,26 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from django.apps import AppConfig
from django.conf import settings
from django.db.models.signals import post_save
from django.utils.translation import gettext_lazy as _
from . import signals
class NoteConfig(AppConfig):
name = 'note'
verbose_name = _('note')
def ready(self):
"""
Define app internal signals to interact with other apps
"""
post_save.connect(
signals.save_user_note,
sender=settings.AUTH_USER_MODEL
)
post_save.connect(
signals.save_club_note,
sender='member.Club'
)