diff --git a/openslides/projector/views.py b/openslides/projector/views.py index fc3015821..83609547b 100644 --- a/openslides/projector/views.py +++ b/openslides/projector/views.py @@ -25,8 +25,8 @@ from django.db.models import Q from utils.views import TemplateView, RedirectView, CreateView, UpdateView, DeleteView -from utils.utils import template, permission_required, \ - del_confirm_form, ajax_request +from utils.utils import (template, permission_required, del_confirm_form, + ajax_request, load_models) from utils.template import render_block_to_string from utils.template import Tab @@ -41,6 +41,7 @@ from openslides.utils.signals import template_manipulation from django.utils.importlib import import_module import settings +load_models() class ControlView(TemplateView): template_name = 'projector/control.html' diff --git a/openslides/utils/utils.py b/openslides/utils/utils.py index ccb7a61ef..84a02e2e6 100644 --- a/openslides/utils/utils.py +++ b/openslides/utils/utils.py @@ -24,11 +24,13 @@ from django.core.context_processors import csrf from django.contrib import messages from django.contrib.auth.models import Permission from django.db.models import signals +from django.utils.importlib import import_module from openslides.utils.signals import template_manipulation from openslides.utils.translation_ext import ugettext as _ from openslides import get_version +import settings def revision(request): @@ -124,3 +126,11 @@ def encodedict(dict): for key in dict: newdict[key] = [unicode(dict[key][0].decode('utf-8'))] return newdict + + +def load_models(): + for app in settings.INSTALLED_APPS: + try: + mod = import_module(app + '.models') + except ImportError: + continue