nk20/apps/note/apps.py

33 lines
830 B
Python
Raw Normal View History

2020-02-18 20:30:26 +00:00
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
2019-07-16 07:05:30 +00:00
# SPDX-License-Identifier: GPL-3.0-or-later
2019-07-08 12:30:58 +00:00
from django.apps import AppConfig
2019-07-19 13:00:44 +00:00
from django.conf import settings
from django.db.models.signals import post_save, pre_delete
2019-07-16 07:05:30 +00:00
from django.utils.translation import gettext_lazy as _
2019-07-08 12:30:58 +00:00
2019-07-19 13:00:44 +00:00
from . import signals
2019-07-08 12:30:58 +00:00
class NoteConfig(AppConfig):
name = 'note'
2019-07-16 07:05:30 +00:00
verbose_name = _('note')
2019-07-19 13:00:44 +00:00
def ready(self):
"""
Define app internal signals to interact with other apps
"""
post_save.connect(
signals.save_user_note,
2020-02-18 11:31:15 +00:00
sender=settings.AUTH_USER_MODEL,
2019-07-19 13:00:44 +00:00
)
post_save.connect(
signals.save_club_note,
2020-02-18 11:31:15 +00:00
sender='member.Club',
2019-07-19 13:00:44 +00:00
)
pre_delete.connect(
signals.delete_transaction,
sender='note.transaction',
)