telegram_bots/aggregator/apps.py
2019-01-30 23:52:05 +03:00

24 lines
681 B
Python

from django.apps import AppConfig
from django.db.models.signals import post_delete
class AggregatorConfig(AppConfig):
name = 'aggregator'
def ready(self):
self.register_config()
self.register_signals()
def register_config(self):
import djconfig
from .forms import AggregatorAppConfigForm
djconfig.register(AggregatorAppConfigForm)
def register_signals(self):
from .models import AggregationSource, Chat
from .signals import aggregation_source_deleted, chat_deleted
post_delete.connect(aggregation_source_deleted, sender=AggregationSource)
post_delete.connect(chat_deleted, sender=Chat)