Exemple #1
0
    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 django.db.models.signals import pre_delete
        from openslides.config.signals import config_signal
        from openslides.projector.api import register_slide
        from openslides.projector.signals import projector_overlays
        from openslides.utils.rest_api import router
        from .signals import agenda_list_of_speakers, setup_agenda_config, listen_to_related_object_delete_signal
        from .slides import agenda_slide
        from .views import ItemViewSet

        # Connect signals.
        config_signal.connect(setup_agenda_config,
                              dispatch_uid='setup_agenda_config')
        projector_overlays.connect(agenda_list_of_speakers,
                                   dispatch_uid='agenda_list_of_speakers')
        pre_delete.connect(
            listen_to_related_object_delete_signal,
            dispatch_uid='agenda_listen_to_related_object_delete_signal')

        # Register slides.
        Item = self.get_model('Item')
        register_slide('agenda', agenda_slide, Item)

        # Register viewsets.
        router.register('agenda/item', ItemViewSet)
Exemple #2
0
    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.utils.rest_api import router
        from openslides.projector.api import register_slide_model
        from .signals import create_builtin_workflows, setup_motion_config
        from .views import CategoryViewSet, MotionViewSet, WorkflowViewSet

        # Connect signals.
        config_signal.connect(setup_motion_config,
                              dispatch_uid='setup_motion_config')
        post_migrate.connect(create_builtin_workflows,
                             dispatch_uid='motion_create_builtin_workflows')

        # Register slides.
        Motion = self.get_model('Motion')
        MotionPoll = self.get_model('MotionPoll')
        register_slide_model(Motion, 'motion/slide.html')
        register_slide_model(MotionPoll, 'motion/motionpoll_slide.html')

        # Register viewsets.
        router.register('motion/category', CategoryViewSet)
        router.register('motion/motion', MotionViewSet)
        router.register('motion/workflow', WorkflowViewSet)
Exemple #3
0
    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.
        from django.db.models.signals import post_save
        from openslides.config.signals import config_signal
        from openslides.projector.api import register_slide_model
        from openslides.utils.rest_api import router
        from .signals import setup_users_config, user_post_save
        from .views import UserViewSet

        # Load User model.
        User = self.get_model('User')

        # Connect signals.
        config_signal.connect(setup_users_config, dispatch_uid='setup_users_config')
        post_save.connect(user_post_save, sender=User, dispatch_uid='users_user_post_save')

        # Register slides.
        register_slide_model(User, 'participant/user_slide.html')

        # Register viewsets.
        router.register('users/user', UserViewSet)
Exemple #4
0
    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.
        from django.db.models import signals
        from openslides.config.signals import config_signal
        from openslides.projector.api import register_slide_model
        from openslides.utils.autoupdate import inform_changed_data_receiver
        from openslides.utils.rest_api import router
        from .signals import setup_general_config
        from .views import CustomSlideViewSet, TagViewSet

        # 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')

        # Register viewsets.
        router.register('core/customslide', CustomSlideViewSet)
        router.register('core/tag', TagViewSet)

        # Update data when any model of any installed app is saved or deleted.
        # TODO: Test if the m2m_changed signal is also needed.
        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')
Exemple #5
0
    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
        from openslides.utils.rest_api import router
        from openslides.utils.signals import template_manipulation
        from .signals import setup_assignment_config
        from .template import add_assignment_stylesheets
        from .views import AssignmentViewSet

        # 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')
        register_slide_model(Assignment, 'assignment/slide.html')
        register_slide_model(AssignmentPoll,
                             'assignment/assignmentpoll_slide.html')

        # Register viewsets.
        router.register('assignment/assignment', AssignmentViewSet)
Exemple #6
0
 def test_get_multiple_config_var_error(self):
     config_signal.connect(
         set_simple_config_view_multiple_vars,
         dispatch_uid='set_simple_config_view_multiple_vars_for_testing')
     self.assertRaisesMessage(
         expected_exception=ConfigError,
         expected_message=
         'Too many values for config variable multiple_config_var found.',
         callable_obj=config.setup_cache)
     config_signal.disconnect(
         set_simple_config_view_multiple_vars,
         dispatch_uid='set_simple_config_view_multiple_vars_for_testing')
Exemple #7
0
    def test_improperly_configured_config_view_two(self):
        from openslides.config import urls
        collection = ConfigCollection(
            url='only_url_ureiraeY1Oochuad7xei',
            variables=(ConfigVariable(name='some_var_vuuC6eiXeiyae3ik4gie',
                                      default_value='',
                                      form_field=forms.CharField()),))

        def setup_bad_config_view_two(sender, **kwargs):
            return collection

        config_signal.connect(setup_bad_config_view_two, dispatch_uid='setup_bad_config_view_twoe_for_testing')
        self.assertRaisesMessage(
            ConfigError,
            'The config collection %s must have a title and an url attribute.' % repr(collection),
            reload,
            urls)
        config_signal.disconnect(setup_bad_config_view_two, dispatch_uid='setup_bad_config_view_twoe_for_testing')
Exemple #8
0
    def test_improperly_configured_config_view(self):
        from openslides.config import urls
        collection = ConfigCollection(
            title='Only a small title but no url ci6xahb8Chula0Thesho',
            variables=(ConfigVariable(name='some_var_paiji9theiW8ooXivae6',
                                      default_value='',
                                      form_field=forms.CharField()),))

        def setup_bad_config_view_one(sender, **kwargs):
            return collection

        config_signal.connect(setup_bad_config_view_one, dispatch_uid='setup_bad_config_view_one_for_testing')
        self.assertRaisesMessage(
            ConfigError,
            'The config collection %s must have a title and an url attribute.' % repr(collection),
            reload,
            urls)
        config_signal.disconnect(setup_bad_config_view_one, dispatch_uid='setup_bad_config_view_one_for_testing')
Exemple #9
0
    def ready(self):
        # Load widgets.
        # Do this by just importing all from this file.
        from . import widgets  # noqa

        # Import all required stuff.
        from openslides.config.signals import config_signal
        from .signals import (countdown, projector_clock, projector_overlays,
                              projector_overlay_message,
                              setup_projector_config)

        # Connect signals.
        config_signal.connect(setup_projector_config,
                              dispatch_uid='setup_projector_config')
        projector_overlays.connect(countdown,
                                   dispatch_uid="projector_countdown")
        projector_overlays.connect(projector_overlay_message,
                                   dispatch_uid="projector_overlay_message")
        projector_overlays.connect(projector_clock,
                                   dispatch_uid="projector_clock")
Exemple #10
0
    def test_improperly_configured_config_view_two(self):
        from openslides.config import urls
        collection = ConfigCollection(url='only_url_ureiraeY1Oochuad7xei',
                                      variables=(ConfigVariable(
                                          name='some_var_vuuC6eiXeiyae3ik4gie',
                                          default_value='',
                                          form_field=forms.CharField()), ))

        def setup_bad_config_view_two(sender, **kwargs):
            return collection

        config_signal.connect(
            setup_bad_config_view_two,
            dispatch_uid='setup_bad_config_view_twoe_for_testing')
        self.assertRaisesMessage(
            ConfigError,
            'The config collection %s must have a title and an url attribute.'
            % repr(collection), reload, urls)
        config_signal.disconnect(
            setup_bad_config_view_two,
            dispatch_uid='setup_bad_config_view_twoe_for_testing')
Exemple #11
0
    def test_improperly_configured_config_view(self):
        from openslides.config import urls
        collection = ConfigCollection(
            title='Only a small title but no url ci6xahb8Chula0Thesho',
            variables=(ConfigVariable(name='some_var_paiji9theiW8ooXivae6',
                                      default_value='',
                                      form_field=forms.CharField()), ))

        def setup_bad_config_view_one(sender, **kwargs):
            return collection

        config_signal.connect(
            setup_bad_config_view_one,
            dispatch_uid='setup_bad_config_view_one_for_testing')
        self.assertRaisesMessage(
            ConfigError,
            'The config collection %s must have a title and an url attribute.'
            % repr(collection), reload, urls)
        config_signal.disconnect(
            setup_bad_config_view_one,
            dispatch_uid='setup_bad_config_view_one_for_testing')
Exemple #12
0
 def test_get_multiple_config_var_error(self):
     config_signal.connect(set_simple_config_page_multiple_vars, dispatch_uid='set_simple_config_page_multiple_vars_for_testing')
     self.assertRaisesMessage(expected_exception=ConfigError,
                              expected_message='Too many values for config variable multiple_config_var found.',
                              callable_obj=config.setup_cache)
     config_signal.disconnect(set_simple_config_page_multiple_vars, dispatch_uid='set_simple_config_page_multiple_vars_for_testing')