diff --git a/openslides/agenda/slides.py b/openslides/agenda/slides.py index c1c24fdf0..68eef0efa 100644 --- a/openslides/agenda/slides.py +++ b/openslides/agenda/slides.py @@ -1,8 +1,7 @@ from django.utils.translation import ugettext as _ -from agenda.models import Item - def agenda_show(): + from agenda.models import Item data = {} items = Item.objects.filter(parent=None) data['title'] = _("Agenda") diff --git a/openslides/application/models.py b/openslides/application/models.py index 82caa16a5..343c11aa8 100644 --- a/openslides/application/models.py +++ b/openslides/application/models.py @@ -23,7 +23,6 @@ from projector.models import SlideMixin from participant.models import Profile from system import config from utils.utils import _propper_unicode -from poll import ChoicePoll from poll.models import BaseOption, BasePoll, CountVotesCast, CountInvalid, Vote diff --git a/openslides/application/templates/application/poll_view.html b/openslides/application/templates/application/poll_view.html index 1dd88711f..f9be853fc 100644 --- a/openslides/application/templates/application/poll_view.html +++ b/openslides/application/templates/application/poll_view.html @@ -42,6 +42,7 @@ {{ pollform.votescast.errors }}{{ pollform.votescast }} + {{ post_form }} diff --git a/openslides/poll/views.py b/openslides/poll/views.py index 3059e4595..f4e72e019 100644 --- a/openslides/poll/views.py +++ b/openslides/poll/views.py @@ -1,7 +1,9 @@ -from django.views.generic import TemplateView from django.http import HttpResponseRedirect from django.forms.models import modelform_factory +from utils.views import TemplateView + + class PollFormView(TemplateView): template_name = 'poll/poll.html' poll_argument = 'poll_id' diff --git a/openslides/projector/api.py b/openslides/projector/api.py index 7a8fd024c..86814da4e 100644 --- a/openslides/projector/api.py +++ b/openslides/projector/api.py @@ -35,8 +35,10 @@ def set_active_slide(sid): config["presentation"] = sid -def register_slidemodel(model, category=None, model_name=''): +def register_slidemodel(model, category=None, model_name=None): #TODO: Warn if there already is a slide with this prefix + if model_name is None: + model_name = model.prefix SLIDE[model.prefix] = Slide( model_slide=True, model=model, diff --git a/openslides/utils/signals.py b/openslides/utils/signals.py new file mode 100644 index 000000000..cc2a368a9 --- /dev/null +++ b/openslides/utils/signals.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" + openslides.utils.signals + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Defines Signals for the openslides-project. + + :copyright: 2011 by the OpenSlides team, see AUTHORS. + :license: GNU GPL, see LICENSE for more details. +""" + +from django.dispatch import Signal + +template_manipulation = Signal(providing_args=['context']) diff --git a/openslides/utils/views.py b/openslides/utils/views.py index 2f14d9a88..0ca691cbe 100644 --- a/openslides/utils/views.py +++ b/openslides/utils/views.py @@ -26,6 +26,7 @@ from django.views.generic import (TemplateView as _TemplateView, from django.views.generic.detail import SingleObjectMixin from utils import render_to_forbitten +from openslides.utils.signals import template_manipulation from pdf import firstPage, laterPages FREE_TO_GO = 'free to go' @@ -55,8 +56,12 @@ class PermissionMixin(object): return super(LoginMixin, self).dispatch(request, *args, **kwargs) + class TemplateView(_TemplateView, PermissionMixin): - pass + def get_context_data(self, **kwargs): + context = super(TemplateView, self).get_context_data(**kwargs) + template_manipulation.send(sender=self, context=context, blub=True) + return context class RedirectView(_RedirectView, PermissionMixin):