示例#1
0
 def setUp(self):
     # Save the old value of the config object and add the test values
     # TODO: Can be changed to setUpClass when Django 1.8 is no longer supported
     self._config_values = config.config_variables.copy()
     config.key_to_id = None
     config.update_config_variables(set_simple_config_view_integration_config_test())
     config.save_default_values()
示例#2
0
    def ready(self):
        # Load projector elements.
        # Do this by just importing all from these files.
        from . import projector  # noqa

        # Import all required stuff.
        from openslides.core.config import config
        from openslides.utils.rest_api import router
        from .config_variables import get_config_variables
        from .signals import create_builtin_workflows
        from .views import CategoryViewSet, MotionViewSet, MotionBlockViewSet, MotionPollViewSet, MotionChangeRecommendationViewSet, WorkflowViewSet

        # Define config variables
        config.update_config_variables(get_config_variables())

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

        # Register viewsets.
        router.register(self.get_model('Category').get_collection_string(), CategoryViewSet)
        router.register(self.get_model('Motion').get_collection_string(), MotionViewSet)
        router.register(self.get_model('MotionBlock').get_collection_string(), MotionBlockViewSet)
        router.register(self.get_model('Workflow').get_collection_string(), WorkflowViewSet)
        router.register(self.get_model('MotionChangeRecommendation').get_collection_string(),
                        MotionChangeRecommendationViewSet)
        router.register('motions/motionpoll', MotionPollViewSet)
示例#3
0
 def test_get_multiple_config_var_error(self):
     with self.assertRaisesMessage(
             ConfigError,
             'Too many values for config variables {\'multiple_config_var\'} found.'
     ):
         config.update_config_variables(
             set_simple_config_view_multiple_vars())
示例#4
0
文件: apps.py 项目: Hellmy/OpenSlides
    def ready(self):
        # Load projector elements.
        # Do this by just importing all from these files.
        from . import projector  # noqa

        # Import all required stuff.
        from openslides.core.config import config
        from openslides.core.signals import permission_change, user_data_required
        from openslides.utils.rest_api import router
        from .config_variables import get_config_variables
        from .signals import get_permission_change_data, is_user_data_required
        from .views import AssignmentViewSet, AssignmentPollViewSet

        # Define config variables
        config.update_config_variables(get_config_variables())

        # Connect signals.
        permission_change.connect(
            get_permission_change_data,
            dispatch_uid='assignments_get_permission_change_data')
        user_data_required.connect(
            is_user_data_required,
            dispatch_uid='assignments_is_user_data_required')

        # Register viewsets.
        router.register(
            self.get_model('Assignment').get_collection_string(),
            AssignmentViewSet)
        router.register('assignments/poll', AssignmentPollViewSet)
示例#5
0
 def setUp(self):
     # Save the old value of the config object and add the test values
     # TODO: Can be changed to setUpClass when Django 1.8 is no longer supported
     self._config_values = config.config_variables.copy()
     config.key_to_id = {}
     config.update_config_variables(set_simple_config_view_integration_config_test())
     config.save_default_values()
示例#6
0
    def ready(self):
        # Load projector elements.
        # Do this by just importing all from these files.
        from . import projector  # noqa

        # Import all required stuff.
        from django.db.models.signals import pre_delete, post_save
        from openslides.core.config import config
        from openslides.utils.rest_api import router
        from .config_variables import get_config_variables
        from .signals import (
            listen_to_related_object_post_delete,
            listen_to_related_object_post_save)
        from .views import ItemViewSet

        # Define config variables
        config.update_config_variables(get_config_variables())

        # Connect signals.
        post_save.connect(
            listen_to_related_object_post_save,
            dispatch_uid='listen_to_related_object_post_save')
        pre_delete.connect(
            listen_to_related_object_post_delete,
            dispatch_uid='listen_to_related_object_post_delete')

        # Register viewsets.
        router.register(self.get_model('Item').get_collection_string(), ItemViewSet)
示例#7
0
    def ready(self):
        # Load projector elements.
        # Do this by just importing all from these files.
        from . import projector  # noqa

        # Import all required stuff.
        from django.db.models.signals import pre_delete, post_save
        from openslides.core.config import config
        from openslides.utils.rest_api import router
        from .config_variables import get_config_variables
        from .signals import (
            listen_to_related_object_post_delete,
            listen_to_related_object_post_save)
        from .views import ItemViewSet

        # Define config variables
        config.update_config_variables(get_config_variables())

        # Connect signals.
        post_save.connect(
            listen_to_related_object_post_save,
            dispatch_uid='listen_to_related_object_post_save')
        pre_delete.connect(
            listen_to_related_object_post_delete,
            dispatch_uid='listen_to_related_object_post_delete')

        # Register viewsets.
        router.register(self.get_model('Item').get_collection_string(), ItemViewSet)
示例#8
0
 def setUp(self):
     # Save the old value of the config object and add the test values
     # TODO: Can be changed to setUpClass when Django 1.8 is no longer supported
     self._config_values = config.config_variables.copy()
     config.update_config_variables(set_grouped_config_view())
     config.update_config_variables(set_simple_config_view())
     config.update_config_variables(set_simple_config_view_multiple_vars())
     config.update_config_variables(set_simple_config_collection_disabled_view())
     config.update_config_variables(set_simple_config_collection_with_callback())
示例#9
0
 def setUp(self):
     # Save the old value of the config object and add the test values
     # TODO: Can be changed to setUpClass when Django 1.8 is no longer supported
     self._config_values = config.config_variables.copy()
     config.update_config_variables(set_grouped_config_view())
     config.update_config_variables(set_simple_config_view())
     config.update_config_variables(set_simple_config_view_multiple_vars())
     config.update_config_variables(set_simple_config_collection_disabled_view())
     config.update_config_variables(set_simple_config_collection_with_callback())
     config.save_default_values()
示例#10
0
    def ready(self):
        # Import all required stuff.
        from openslides.core.config import config
        from openslides.core.signals import permission_change, user_data_required
        from openslides.utils.rest_api import router
        from .config_variables import get_config_variables
        from .projector import get_projector_elements
        from .signals import (
            create_builtin_workflows,
            get_permission_change_data,
            required_users,
        )
        from .views import (
            CategoryViewSet,
            MotionViewSet,
            MotionBlockViewSet,
            MotionPollViewSet,
            MotionChangeRecommendationViewSet,
            WorkflowViewSet,
        )

        # Define config variables and projector elements.
        config.update_config_variables(get_config_variables())
        register_projector_elements(get_projector_elements())

        # Connect signals.
        post_migrate.connect(create_builtin_workflows,
                             dispatch_uid='motion_create_builtin_workflows')
        permission_change.connect(
            get_permission_change_data,
            dispatch_uid='motions_get_permission_change_data')
        user_data_required.connect(required_users,
                                   dispatch_uid='motions_required_users')

        # Register viewsets.
        router.register(
            self.get_model('Category').get_collection_string(),
            CategoryViewSet)
        router.register(
            self.get_model('Motion').get_collection_string(), MotionViewSet)
        router.register(
            self.get_model('MotionBlock').get_collection_string(),
            MotionBlockViewSet)
        router.register(
            self.get_model('Workflow').get_collection_string(),
            WorkflowViewSet)
        router.register(
            self.get_model(
                'MotionChangeRecommendation').get_collection_string(),
            MotionChangeRecommendationViewSet)
        router.register(
            self.get_model('MotionPoll').get_collection_string(),
            MotionPollViewSet)
示例#11
0
    def ready(self):
        # Load projector elements.
        # Do this by just importing all from these files.
        from . import projector  # noqa

        # Import all required stuff.
        from django.db.models import signals
        from openslides.core.config import config
        from openslides.core.signals import post_permission_creation
        from openslides.utils.rest_api import router
        from openslides.utils.search import index_add_instance, index_del_instance
        from .config_variables import get_config_variables
        from .signals import delete_django_app_permissions, create_builtin_projection_defaults
        from .views import (
            ChatMessageViewSet,
            ConfigViewSet,
            ProjectorViewSet,
            TagViewSet,
        )

        # Define config variables
        config.update_config_variables(get_config_variables())

        # Connect signals.
        post_permission_creation.connect(
            delete_django_app_permissions,
            dispatch_uid='delete_django_app_permissions')
        post_permission_creation.connect(
            create_builtin_projection_defaults,
            dispatch_uid='create_builtin_projection_defaults')

        # Register viewsets.
        router.register(
            self.get_model('Projector').get_collection_string(),
            ProjectorViewSet)
        router.register(
            self.get_model('ChatMessage').get_collection_string(),
            ChatMessageViewSet)
        router.register(
            self.get_model('Tag').get_collection_string(), TagViewSet)
        router.register(
            self.get_model('ConfigStore').get_collection_string(),
            ConfigViewSet, 'config')

        # Update the search when a model is saved or deleted
        signals.post_save.connect(index_add_instance,
                                  dispatch_uid='index_add_instance')
        signals.post_delete.connect(index_del_instance,
                                    dispatch_uid='index_del_instance')
        signals.m2m_changed.connect(index_add_instance,
                                    dispatch_uid='m2m_index_add_instance')
示例#12
0
    def ready(self):
        # Load projector elements.
        # Do this by just importing all from these files.
        from . import projector  # noqa

        # Import all required stuff.
        from django.db.models import signals
        from openslides.core.config import config
        from openslides.core.signals import post_permission_creation
        from openslides.utils.rest_api import router
        from openslides.utils.search import index_add_instance, index_del_instance
        from .config_variables import get_config_variables
        from .signals import delete_django_app_permissions
        from .views import (
            ChatMessageViewSet,
            ConfigViewSet,
            CountdownViewSet,
            ProjectorMessageViewSet,
            ProjectorViewSet,
            TagViewSet,
        )

        # Define config variables
        config.update_config_variables(get_config_variables())

        # Connect signals.
        post_permission_creation.connect(
            delete_django_app_permissions,
            dispatch_uid='delete_django_app_permissions')

        # Register viewsets.
        router.register(self.get_model('Projector').get_collection_string(), ProjectorViewSet)
        router.register(self.get_model('ChatMessage').get_collection_string(), ChatMessageViewSet)
        router.register(self.get_model('Tag').get_collection_string(), TagViewSet)
        router.register(self.get_model('ConfigStore').get_collection_string(), ConfigViewSet, 'config')
        router.register(self.get_model('ProjectorMessage').get_collection_string(), ProjectorMessageViewSet)
        router.register(self.get_model('Countdown').get_collection_string(), CountdownViewSet)

        # Update the search when a model is saved or deleted
        signals.post_save.connect(
            index_add_instance,
            dispatch_uid='index_add_instance')
        signals.post_delete.connect(
            index_del_instance,
            dispatch_uid='index_del_instance')
        signals.m2m_changed.connect(
            index_add_instance,
            dispatch_uid='m2m_index_add_instance')
    def ready(self):
        # Load projector elements.
        # Do this by just importing all from these files.
        from . import projector  # noqa

        # Import all required stuff.
        from openslides.core.config import config
        from openslides.core.signals import post_permission_creation
        from openslides.utils.rest_api import router
        from .config_variables import get_config_variables
        from .signals import (
            add_default_seating_plan,
            add_permissions_to_builtin_groups
        )
        from .urls import urlpatterns
        from .views import (
            AssignmentPollKeypadConnectionViewSet,
            KeypadViewSet,
            MotionPollKeypadConnectionViewSet,
            SeatViewSet,
            VotecollectorViewSet
        )

        # Define config variables
        config.update_config_variables(get_config_variables())

        # Connect signals.
        post_permission_creation.connect(
            add_permissions_to_builtin_groups,
            dispatch_uid='votecollector_add_permissions_to_builtin_groups'
        )
        post_permission_creation.connect(
            add_default_seating_plan,
            dispatch_uid='votecollector_add_default_seating_plan'
        )

        # Register viewsets.
        router.register(self.get_model('VoteCollector').get_collection_string(), VotecollectorViewSet)
        router.register(self.get_model('Seat').get_collection_string(), SeatViewSet)
        router.register(self.get_model('Keypad').get_collection_string(), KeypadViewSet)
        router.register(self.get_model('MotionPollKeypadConnection').get_collection_string(),
                        MotionPollKeypadConnectionViewSet)
        router.register(self.get_model('AssignmentPollKeypadConnection').get_collection_string(),
                        AssignmentPollKeypadConnectionViewSet)

        # Provide plugin urlpatterns to application configuration
        self.urlpatterns = urlpatterns
示例#14
0
    def ready(self):
        # Load projector elements.
        # Do this by just importing all from these files.
        from . import projector  # noqa

        # Import all required stuff.
        from openslides.core.config import config
        from openslides.core.signals import post_permission_creation
        from openslides.utils.rest_api import router
        from .config_variables import get_config_variables
        from .signals import (add_default_seating_plan,
                              add_permissions_to_builtin_groups)
        from .urls import urlpatterns
        from .views import (AssignmentPollKeypadConnectionViewSet,
                            KeypadViewSet, MotionPollKeypadConnectionViewSet,
                            SeatViewSet, VotecollectorViewSet)

        # Define config variables
        config.update_config_variables(get_config_variables())

        # Connect signals.
        post_permission_creation.connect(
            add_permissions_to_builtin_groups,
            dispatch_uid='votecollector_add_permissions_to_builtin_groups')
        post_permission_creation.connect(
            add_default_seating_plan,
            dispatch_uid='votecollector_add_default_seating_plan')

        # Register viewsets.
        router.register(
            self.get_model('VoteCollector').get_collection_string(),
            VotecollectorViewSet)
        router.register(
            self.get_model('Seat').get_collection_string(), SeatViewSet)
        router.register(
            self.get_model('Keypad').get_collection_string(), KeypadViewSet)
        router.register(
            self.get_model(
                'MotionPollKeypadConnection').get_collection_string(),
            MotionPollKeypadConnectionViewSet)
        router.register(
            self.get_model(
                'AssignmentPollKeypadConnection').get_collection_string(),
            AssignmentPollKeypadConnectionViewSet)

        # Provide plugin urlpatterns to application configuration
        self.urlpatterns = urlpatterns
示例#15
0
    def ready(self):
        # Import all required stuff.
        from openslides.core.config import config
        from openslides.core.signals import permission_change, user_data_required
        from openslides.utils.rest_api import router
        from .config_variables import get_config_variables
        from .projector import get_projector_elements
        from .signals import (
            create_builtin_workflows,
            get_permission_change_data,
            required_users,
        )
        from .views import (
            CategoryViewSet,
            MotionViewSet,
            MotionBlockViewSet,
            MotionPollViewSet,
            MotionChangeRecommendationViewSet,
            StateViewSet,
            WorkflowViewSet,
        )

        # Define config variables and projector elements.
        config.update_config_variables(get_config_variables())
        register_projector_elements(get_projector_elements())

        # Connect signals.
        post_migrate.connect(
            create_builtin_workflows,
            dispatch_uid='motion_create_builtin_workflows')
        permission_change.connect(
            get_permission_change_data,
            dispatch_uid='motions_get_permission_change_data')
        user_data_required.connect(
            required_users,
            dispatch_uid='motions_required_users')

        # Register viewsets.
        router.register(self.get_model('Category').get_collection_string(), CategoryViewSet)
        router.register(self.get_model('Motion').get_collection_string(), MotionViewSet)
        router.register(self.get_model('MotionBlock').get_collection_string(), MotionBlockViewSet)
        router.register(self.get_model('Workflow').get_collection_string(), WorkflowViewSet)
        router.register(self.get_model('MotionChangeRecommendation').get_collection_string(),
                        MotionChangeRecommendationViewSet)
        router.register(self.get_model('MotionPoll').get_collection_string(), MotionPollViewSet)
        router.register(self.get_model('State').get_collection_string(), StateViewSet)
示例#16
0
    def ready(self):
        # Load projector elements.
        # Do this by just importing all from these files.
        from . import projector  # noqa

        # Import all required stuff.
        from openslides.core.config import config
        from openslides.utils.rest_api import router
        from .config_variables import get_config_variables
        from .views import AssignmentViewSet, AssignmentPollViewSet

        # Define config variables
        config.update_config_variables(get_config_variables())

        # Register viewsets.
        router.register(self.get_model('Assignment').get_collection_string(), AssignmentViewSet)
        router.register('assignments/poll', AssignmentPollViewSet)
示例#17
0
文件: apps.py 项目: Hellmy/OpenSlides
    def ready(self):
        # Load projector elements.
        # Do this by just importing all from these files.
        from . import projector  # noqa

        # Import all required stuff.
        from openslides.core.config import config
        from openslides.core.signals import permission_change, user_data_required
        from openslides.utils.rest_api import router
        from .config_variables import get_config_variables
        from .signals import create_builtin_workflows, get_permission_change_data, is_user_data_required
        from .views import CategoryViewSet, MotionViewSet, MotionBlockViewSet, MotionPollViewSet, MotionChangeRecommendationViewSet, WorkflowViewSet

        # Define config variables
        config.update_config_variables(get_config_variables())

        # Connect signals.
        post_migrate.connect(create_builtin_workflows,
                             dispatch_uid='motion_create_builtin_workflows')
        permission_change.connect(
            get_permission_change_data,
            dispatch_uid='motions_get_permission_change_data')
        user_data_required.connect(
            is_user_data_required,
            dispatch_uid='motions_is_user_data_required')

        # Register viewsets.
        router.register(
            self.get_model('Category').get_collection_string(),
            CategoryViewSet)
        router.register(
            self.get_model('Motion').get_collection_string(), MotionViewSet)
        router.register(
            self.get_model('MotionBlock').get_collection_string(),
            MotionBlockViewSet)
        router.register(
            self.get_model('Workflow').get_collection_string(),
            WorkflowViewSet)
        router.register(
            self.get_model(
                'MotionChangeRecommendation').get_collection_string(),
            MotionChangeRecommendationViewSet)
        router.register(
            self.get_model('MotionPoll').get_collection_string(),
            MotionPollViewSet)
示例#18
0
    def ready(self):
        from .urls import urlpatterns
        from openslides.core.config import config
        from openslides.core.signals import post_permission_creation
        from .config_variables import get_config_variables
        from .signals import (
            add_permissions_to_builtin_groups
        )
        self.urlpatterns = urlpatterns

        # Define config variables
        config.update_config_variables(get_config_variables())

        # Connect signals
        post_permission_creation.connect(
            add_permissions_to_builtin_groups,
            dispatch_uid='openslides_conversations_add_permissions_to_builtin_groups'
        )
示例#19
0
    def ready(self):
        # Load projector elements.
        # Do this by just importing all from these files.
        from . import projector  # noqa

        # Import all required stuff.
        from openslides.core.config import config
        from openslides.utils.rest_api import router
        from .config_variables import get_config_variables
        from .views import AssignmentViewSet, AssignmentPollViewSet

        # Define config variables
        config.update_config_variables(get_config_variables())

        # Register viewsets.
        router.register(
            self.get_model('Assignment').get_collection_string(),
            AssignmentViewSet)
        router.register('assignments/poll', AssignmentPollViewSet)
示例#20
0
    def ready(self):
        # Import all required stuff.
        from openslides.core.config import config
        from openslides.core.signals import post_permission_creation
        from openslides.utils.rest_api import router
        from .config_variables import get_config_variables
        from .signals import add_permissions_to_builtin_groups
        from .views import ObjectProtocolViewSet, ProtocolViewSet

        # Define config variables
        config.update_config_variables(get_config_variables())

        # Connect signals.
        post_permission_creation.connect(
            add_permissions_to_builtin_groups,
            dispatch_uid='protocol_add_permissions_to_builtin_groups'
        )

        # Register viewsets.
        router.register(self.get_model('ObjectProtocol').get_collection_string(), ObjectProtocolViewSet)
        router.register(self.get_model('Protocol').get_collection_string(), ProtocolViewSet)
示例#21
0
    def ready(self):
        # Load projector elements.
        # Do this by just importing all from these files.
        from . import projector  # noqa

        # Import all required stuff.
        from openslides.core.config import config
        from openslides.utils.rest_api import router
        from .config_variables import get_config_variables
        from .signals import create_builtin_workflows
        from .views import CategoryViewSet, MotionViewSet, MotionPollViewSet, WorkflowViewSet

        # Define config variables
        config.update_config_variables(get_config_variables())

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

        # Register viewsets.
        router.register(self.get_model('Category').get_collection_string(), CategoryViewSet)
        router.register(self.get_model('Motion').get_collection_string(), MotionViewSet)
        router.register(self.get_model('Workflow').get_collection_string(), WorkflowViewSet)
        router.register('motions/motionpoll', MotionPollViewSet)
示例#22
0
 def test_get_multiple_config_var_error(self):
     with self.assertRaisesMessage(
             ConfigError,
             'Too many values for config variables {\'multiple_config_var\'} found.'):
         config.update_config_variables(set_simple_config_view_multiple_vars())
示例#23
0
    def ready(self):
        # Load projector elements.
        # Do this by just importing all from these files.
        from . import projector

        # Import all required stuff.
        from openslides.core.config import config
        from openslides.core.signals import post_permission_creation
        from openslides.users.models import Group, User
        from openslides.utils.rest_api import router
        from .config_variables import get_config_variables
        from .projector import get_projector_elements
        from .signals import (
            add_permissions_to_builtin_groups,
            update_authorized_voters,
            inform_keypad_deleted,
        )
        from .urls import urlpatterns
        from .models import Keypad, VotingShare
        from .views import (
            AssignmentAbsenteeVoteViewSet,
            AssignmentPollBallotViewSet,
            AssignmentPollTypeViewSet,
            AttendanceLogViewSet,
            AuthorizedVotersViewSet,
            KeypadViewSet,
            MotionAbsenteeVoteViewSet,
            MotionPollBallotViewSet,
            MotionPollTypeViewSet,
            VotingControllerViewSet,
            VotingPrincipleViewSet,
            VotingProxyViewSet,
            VotingShareViewSet,
            VotingTokenViewSet
        )

        # Register projector elements
        register_projector_elements(get_projector_elements())

        # Define config variables
        config.update_config_variables(get_config_variables())

        # Connect signals.
        post_permission_creation.connect(
            add_permissions_to_builtin_groups,
            dispatch_uid='voting_add_permissions_to_builtin_groups'
        )

        post_delete.connect(inform_keypad_deleted, sender=Keypad)

        # Register viewsets.
        router.register(self.get_model('AssignmentAbsenteeVote').get_collection_string(), AssignmentAbsenteeVoteViewSet)
        router.register(self.get_model('AssignmentPollBallot').get_collection_string(), AssignmentPollBallotViewSet)
        router.register(self.get_model('AssignmentPollType').get_collection_string(), AssignmentPollTypeViewSet)
        router.register(self.get_model('AttendanceLog').get_collection_string(), AttendanceLogViewSet)
        router.register(self.get_model('AuthorizedVoters').get_collection_string(), AuthorizedVotersViewSet)
        router.register(self.get_model('Keypad').get_collection_string(), KeypadViewSet)
        router.register(self.get_model('MotionAbsenteeVote').get_collection_string(), MotionAbsenteeVoteViewSet)
        router.register(self.get_model('MotionPollBallot').get_collection_string(), MotionPollBallotViewSet)
        router.register(self.get_model('MotionPollType').get_collection_string(), MotionPollTypeViewSet)
        router.register(self.get_model('VotingToken').get_collection_string(), VotingTokenViewSet)
        router.register(self.get_model('VotingController').get_collection_string(), VotingControllerViewSet)
        router.register(self.get_model('VotingPrinciple').get_collection_string(), VotingPrincipleViewSet)
        router.register(self.get_model('VotingShare').get_collection_string(), VotingShareViewSet)
        router.register(self.get_model('VotingProxy').get_collection_string(), VotingProxyViewSet)

        # Provide plugin urlpatterns to application configuration.
        self.urlpatterns = urlpatterns