2014-11-13 22:23:16 +01:00
|
|
|
from django.apps import AppConfig
|
|
|
|
|
|
|
|
|
|
|
|
class CoreAppConfig(AppConfig):
|
|
|
|
name = 'openslides.core'
|
|
|
|
verbose_name = 'OpenSlides Core'
|
|
|
|
|
|
|
|
def ready(self):
|
|
|
|
# Load main menu entry and widgets.
|
|
|
|
# Do this by just importing all from these files.
|
|
|
|
from . import main_menu, widgets # noqa
|
|
|
|
|
|
|
|
# Import all required stuff.
|
2015-01-17 14:01:44 +01:00
|
|
|
from django.db.models import signals
|
2014-11-13 22:23:16 +01:00
|
|
|
from openslides.config.signals import config_signal
|
|
|
|
from openslides.projector.api import register_slide_model
|
2015-01-17 14:01:44 +01:00
|
|
|
from openslides.utils.autoupdate import inform_changed_data_receiver
|
2015-01-06 00:04:36 +01:00
|
|
|
from openslides.utils.rest_api import router
|
2014-11-13 22:23:16 +01:00
|
|
|
from .signals import setup_general_config
|
2015-01-17 14:25:05 +01:00
|
|
|
from .views import CustomSlideViewSet, TagViewSet
|
2014-11-13 22:23:16 +01:00
|
|
|
|
|
|
|
# Connect signals.
|
|
|
|
config_signal.connect(setup_general_config, dispatch_uid='setup_general_config')
|
|
|
|
|
|
|
|
# Register slides.
|
|
|
|
CustomSlide = self.get_model('CustomSlide')
|
|
|
|
register_slide_model(CustomSlide, 'core/customslide_slide.html')
|
2015-01-06 00:04:36 +01:00
|
|
|
|
|
|
|
# Register viewset.
|
|
|
|
router.register('core/customslide', CustomSlideViewSet)
|
2015-01-17 14:25:05 +01:00
|
|
|
router.register('core/tag', TagViewSet)
|
2015-01-17 14:01:44 +01:00
|
|
|
|
|
|
|
# Update data when any model of any installed app is saved or deleted
|
|
|
|
signals.post_save.connect(inform_changed_data_receiver, dispatch_uid='inform_changed_data_receiver')
|
|
|
|
signals.post_delete.connect(inform_changed_data_receiver, dispatch_uid='inform_changed_data_receiver')
|
|
|
|
# TODO: test if the m2m_changed signal is also needed
|