2016-09-18 22:14:24 +02:00
|
|
|
from django.apps import AppConfig
|
|
|
|
|
2017-08-30 00:07:54 +02:00
|
|
|
from ..utils.projector import register_projector_elements
|
2017-03-06 16:34:20 +01:00
|
|
|
|
2016-09-18 22:14:24 +02:00
|
|
|
|
|
|
|
class TopicsAppConfig(AppConfig):
|
2019-01-06 16:22:33 +01:00
|
|
|
name = "openslides.topics"
|
|
|
|
verbose_name = "OpenSlides Topics"
|
2016-09-18 22:14:24 +02:00
|
|
|
angular_site_module = True
|
|
|
|
angular_projector_module = True
|
|
|
|
|
|
|
|
def ready(self):
|
|
|
|
# Import all required stuff.
|
2017-03-07 10:23:24 +01:00
|
|
|
from openslides.core.signals import permission_change
|
2016-09-18 22:14:24 +02:00
|
|
|
from ..utils.rest_api import router
|
2017-08-30 00:07:54 +02:00
|
|
|
from .projector import get_projector_elements
|
2017-03-07 10:23:24 +01:00
|
|
|
from .signals import get_permission_change_data
|
2016-09-18 22:14:24 +02:00
|
|
|
from .views import TopicViewSet
|
2018-11-05 09:04:41 +01:00
|
|
|
from . import serializers # noqa
|
2016-09-18 22:14:24 +02:00
|
|
|
|
2017-08-30 00:07:54 +02:00
|
|
|
# Define projector elements.
|
|
|
|
register_projector_elements(get_projector_elements())
|
|
|
|
|
2017-03-07 10:23:24 +01:00
|
|
|
# Connect signals.
|
|
|
|
permission_change.connect(
|
2019-01-06 16:22:33 +01:00
|
|
|
get_permission_change_data, dispatch_uid="topics_get_permission_change_data"
|
|
|
|
)
|
2017-03-07 10:23:24 +01:00
|
|
|
|
2016-09-18 22:14:24 +02:00
|
|
|
# Register viewsets.
|
2019-01-06 16:22:33 +01:00
|
|
|
router.register(self.get_model("Topic").get_collection_string(), TopicViewSet)
|
2017-01-14 12:29:42 +01:00
|
|
|
|
|
|
|
def get_startup_elements(self):
|
2017-03-06 16:34:20 +01:00
|
|
|
"""
|
2018-07-09 23:22:26 +02:00
|
|
|
Yields all Cachables required on startup i. e. opening the websocket
|
2017-03-06 16:34:20 +01:00
|
|
|
connection.
|
|
|
|
"""
|
2019-01-06 16:22:33 +01:00
|
|
|
yield self.get_model("Topic")
|