2014-11-13 22:23:16 +01:00
|
|
|
from django.apps import AppConfig
|
|
|
|
|
|
|
|
|
|
|
|
class AssignmentAppConfig(AppConfig):
|
2015-03-26 05:36:10 +01:00
|
|
|
name = 'openslides.assignments'
|
|
|
|
verbose_name = 'OpenSlides Assignments'
|
2014-11-13 22:23:16 +01:00
|
|
|
|
|
|
|
def ready(self):
|
|
|
|
# Load main menu entry, personal info and widgets.
|
|
|
|
# Do this by just importing all from these files.
|
|
|
|
from . import main_menu, personal_info, widgets # noqa
|
|
|
|
|
|
|
|
# Import all required stuff.
|
|
|
|
from openslides.config.signals import config_signal
|
|
|
|
from openslides.projector.api import register_slide_model
|
2015-01-17 14:25:05 +01:00
|
|
|
from openslides.utils.rest_api import router
|
2014-11-13 22:23:16 +01:00
|
|
|
from openslides.utils.signals import template_manipulation
|
|
|
|
from .signals import setup_assignment_config
|
|
|
|
from .template import add_assignment_stylesheets
|
2015-06-14 23:26:06 +02:00
|
|
|
from .views import AssignmentViewSet, AssignmentPollViewSet
|
2014-11-13 22:23:16 +01:00
|
|
|
|
|
|
|
# Connect signals.
|
|
|
|
config_signal.connect(setup_assignment_config, dispatch_uid='setup_assignment_config')
|
|
|
|
|
|
|
|
# Connect template signal.
|
|
|
|
template_manipulation.connect(add_assignment_stylesheets, dispatch_uid='add_assignment_stylesheets')
|
|
|
|
|
|
|
|
# Register slides.
|
|
|
|
Assignment = self.get_model('Assignment')
|
|
|
|
AssignmentPoll = self.get_model('AssignmentPoll')
|
2015-03-26 05:36:10 +01:00
|
|
|
register_slide_model(Assignment, 'assignments/slide.html')
|
|
|
|
register_slide_model(AssignmentPoll, 'assignments/assignmentpoll_slide.html')
|
2015-01-17 14:25:05 +01:00
|
|
|
|
|
|
|
# Register viewsets.
|
2015-03-26 05:36:10 +01:00
|
|
|
router.register('assignments/assignment', AssignmentViewSet)
|
2015-06-14 23:26:06 +02:00
|
|
|
router.register('assignments/assignmentpoll', AssignmentPollViewSet)
|