diff --git a/openslides/motion/models.py b/openslides/motion/models.py
index 97cd9c04f..fb252e2a8 100644
--- a/openslides/motion/models.py
+++ b/openslides/motion/models.py
@@ -314,6 +314,13 @@ class Motion(SlideMixin, models.Model):
data['template'] = 'projector/Motion.html'
return data
+ def get_agenda_title(self):
+ return self.last_version.title
+
+ ## def get_agenda_title_supplement(self):
+ ## number = self.number or '[%s]' % ugettext('no number')
+ ## return '(%s %s)' % (ugettext('motion'), number)
+
class MotionVersion(models.Model):
title = models.CharField(max_length=255, verbose_name=ugettext_lazy("Title"))
diff --git a/openslides/motion/urls.py b/openslides/motion/urls.py
index cfca9dfa0..f1781650c 100644
--- a/openslides/motion/urls.py
+++ b/openslides/motion/urls.py
@@ -77,4 +77,9 @@ urlpatterns = patterns('openslides.motion.views',
'reset_state',
name='motion_reset_state',
),
+
+ url(r'^(?P\d+)/agenda/$',
+ 'create_agenda_item',
+ name='motion_create_agenda',
+ ),
)
diff --git a/openslides/motion/views.py b/openslides/motion/views.py
index 2c692d091..bb7405629 100644
--- a/openslides/motion/views.py
+++ b/openslides/motion/views.py
@@ -29,6 +29,7 @@ from openslides.poll.views import PollFormView
from openslides.projector.api import get_active_slide
from openslides.projector.projector import Widget, SLIDE
from openslides.config.models import config
+from openslides.agenda.models import Item
from .models import Motion, MotionSubmitter, MotionSupporter, MotionPoll
from .forms import (BaseMotionForm, MotionSubmitterMixin, MotionSupporterMixin,
MotionCreateNewVersionMixin, ConfigForm)
@@ -274,6 +275,21 @@ set_state = MotionSetStateView.as_view()
reset_state = MotionSetStateView.as_view(reset=True)
+class CreateAgendaItemView(SingleObjectMixin, RedirectView):
+ permission_required = 'agenda.can_manage_agenda'
+ url_name = 'item_overview'
+ model = Motion
+
+ def get(self, request, *args, **kwargs):
+ self.object = self.get_object()
+ return super(CreateAgendaItemView, self).get(request, *args, **kwargs)
+
+ def pre_redirect(self, request, *args, **kwargs):
+ self.item = Item.objects.create(related_sid=self.object.sid)
+
+create_agenda_item = CreateAgendaItemView.as_view()
+
+
class Config(FormView):
permission_required = 'config.can_manage_config'
form_class = ConfigForm
diff --git a/tests/motion/test_models.py b/tests/motion/test_models.py
index eda00fdd2..ee4dc38be 100644
--- a/tests/motion/test_models.py
+++ b/tests/motion/test_models.py
@@ -83,7 +83,7 @@ class ModelTest(TestCase):
self.assertEqual(self.motion.get_absolute_url('detail'), '/motion/%d/' % motion_id)
self.assertEqual(self.motion.get_absolute_url('edit'), '/motion/%d/edit/' % motion_id)
- #self.assertEqual(self.motion.get_absolute_url('delete'), '/motion/%d/del/' % motion_id)
+ self.assertEqual(self.motion.get_absolute_url('delete'), '/motion/%d/del/' % motion_id)
def test_supporter(self):
self.assertFalse(self.motion.is_supporter(self.test_user))