diff --git a/openslides/agenda/__init__.py b/openslides/agenda/__init__.py
index 0ef12a1e8..8b1378917 100644
--- a/openslides/agenda/__init__.py
+++ b/openslides/agenda/__init__.py
@@ -1,4 +1 @@
-from projector.api import register_slidefunc
-from agenda.slides import agenda_show
-register_slidefunc('agenda_show', agenda_show)
diff --git a/openslides/agenda/models.py b/openslides/agenda/models.py
index ee8ba87ea..22812bc6a 100644
--- a/openslides/agenda/models.py
+++ b/openslides/agenda/models.py
@@ -152,4 +152,11 @@ ItemText = Item # ItemText is Depricated
register_slidemodel(Item)
+# TODO: put this in anouther file
+
+from projector.api import register_slidefunc
+from agenda.slides import agenda_show
+
+register_slidefunc('agenda_show', agenda_show)
+
diff --git a/openslides/application/models.py b/openslides/application/models.py
index 35e1f7d2c..1264b259e 100644
--- a/openslides/application/models.py
+++ b/openslides/application/models.py
@@ -501,3 +501,6 @@ class ApplicationOption(BaseOption):
class ApplicationPoll(BasePoll):
option_class = ApplicationOption
+
+ def get_application(self):
+ return self.get_options()[0].application
diff --git a/openslides/application/templates/application/view.html b/openslides/application/templates/application/view.html
index 4fedb25b4..e3cc2ad5f 100644
--- a/openslides/application/templates/application/view.html
+++ b/openslides/application/templates/application/view.html
@@ -72,6 +72,7 @@
{% if poll.has_vote %}{% endif %}
{% endif %}
+ {% trans 'project' %}
{% if poll.has_vote %}
{% for option in poll.options %}
diff --git a/openslides/application/urls.py b/openslides/application/urls.py
index 64f1fb3d2..6d513e460 100644
--- a/openslides/application/urls.py
+++ b/openslides/application/urls.py
@@ -13,7 +13,7 @@
from django.conf.urls.defaults import *
from django.utils.translation import ugettext as _
-from application.views import ViewPoll
+from application.views import ViewPoll, ActivatePoll
urlpatterns = patterns('application.views',
@@ -83,7 +83,12 @@ urlpatterns = patterns('application.views',
url(r'^application/poll/(?P\d+)$',
ViewPoll.as_view(),
- name='application_poll_view'
+ name='application_poll_view',
+ ),
+
+ url(r'^application/poll/(?P\d+)/activate$',
+ ActivatePoll.as_view(),
+ name='application_poll_activate',
),
url(r'^application/poll/(?P\d+)/del$', 'delete_poll', \
diff --git a/openslides/application/views.py b/openslides/application/views.py
index 9f55aaaf8..e829499c1 100644
--- a/openslides/application/views.py
+++ b/openslides/application/views.py
@@ -22,6 +22,7 @@ from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from django.utils.translation import ungettext
from django.db import transaction
+from django.views.generic.base import RedirectView
from system import config
@@ -424,7 +425,7 @@ class ViewPoll(PollFormView):
def get_context_data(self, **kwargs):
context = super(ViewPoll, self).get_context_data()
- self.application = self.poll.get_options()[0].application
+ self.application = self.poll.get_application()
context['application'] = self.application
return context
@@ -434,6 +435,20 @@ class ViewPoll(PollFormView):
return ''
+class ActivatePoll(RedirectView):
+ permanent = False
+
+ def get_redirect_url(self, **kwargs):
+ poll = ApplicationPoll.objects.get(pk=self.kwargs['poll_id'])
+ application = poll.get_application()
+ return reverse('application_view', args=[application.id])
+
+ def get(self, request, *args, **kwargs):
+ self.poll = ApplicationPoll.objects.get(pk=self.kwargs['poll_id'])
+ self.poll.set_active()
+ return super(ActivatePoll, self).get(request, *args, **kwargs)
+
+
@permission_required('application.can_manage_application')
def permit_version(request, aversion_id):
aversion = AVersion.objects.get(pk=aversion_id)
diff --git a/openslides/poll/forms.py b/openslides/poll/forms.py
index a4f53b55d..40fb1cee3 100644
--- a/openslides/poll/forms.py
+++ b/openslides/poll/forms.py
@@ -1,4 +1,5 @@
from django import forms
+from django.utils.translation import ugettext as _
class OptionForm(forms.Form):
def __init__(self, *args, **kwargs):
diff --git a/openslides/poll/models.py b/openslides/poll/models.py
index 89ccff15c..60e3d7d56 100644
--- a/openslides/poll/models.py
+++ b/openslides/poll/models.py
@@ -13,8 +13,10 @@
from django.db import models
from django.utils.translation import ugettext as _
-#from projector.api import register_slidemodel
-#from projector.models import Slide
+from projector.api import register_slidemodel
+from projector.models import Slide
+
+from poll.forms import OptionForm
class BaseOption(models.Model):
@@ -42,7 +44,7 @@ class Vote(models.Model):
value = models.CharField(max_length=255, null=True)
-class BasePoll(models.Model): #, Slide):
+class BasePoll(models.Model, Slide):
prefix = 'BasePoll'
description = models.TextField(null=True, blank=True, verbose_name = _("Description"))
@@ -97,9 +99,13 @@ class BasePoll(models.Model): #, Slide):
form = self.get_vote_form(formid=option.id, **kwargs)
form.option = option
forms.append(form)
-
return forms
+ def slide(self):
+ data = super(BasePoll, self).slide()
+ # data['template'] = 'projector/TODO.html'
+ return data
-#register_slidemodel(BasePoll)
+
+register_slidemodel(BasePoll)
diff --git a/openslides/projector/models.py b/openslides/projector/models.py
index dae3d1440..7cb80ae58 100644
--- a/openslides/projector/models.py
+++ b/openslides/projector/models.py
@@ -13,6 +13,7 @@ class Slide(object):
return {
'slide': self,
'title': 'dummy-title',
+ 'template': 'projector/default.html',
}
@property