diff --git a/openslides/motion/__init__.py b/openslides/motion/__init__.py
index f7f3759f3..092f9eb05 100644
--- a/openslides/motion/__init__.py
+++ b/openslides/motion/__init__.py
@@ -1 +1,3 @@
import openslides.motion.signals
+import openslides.motion.slides
+
diff --git a/openslides/motion/models.py b/openslides/motion/models.py
index 5380ba6f8..72734da68 100644
--- a/openslides/motion/models.py
+++ b/openslides/motion/models.py
@@ -54,7 +54,7 @@ class Motion(SlideMixin, models.Model):
"""
The Motion-Model.
"""
- prefix = "motion" # Rename this in the slide-system
+ prefix = "motion"
# TODO: Use this attribute for the default_version, if the permission system
# is deactivated. Maybe it has to be renamed.
@@ -278,7 +278,10 @@ class Motion(SlideMixin, models.Model):
"""
Get the state of this motion. Return a State object.
"""
- return get_state(self.state_id)
+ try:
+ return get_state(self.state_id)
+ except WorkflowError:
+ return None
def set_state(self, next_state):
"""
diff --git a/openslides/motion/slides.py b/openslides/motion/slides.py
new file mode 100644
index 000000000..9f93fdd38
--- /dev/null
+++ b/openslides/motion/slides.py
@@ -0,0 +1,4 @@
+from openslides.projector.api import register_slidemodel
+from .models import Motion
+
+register_slidemodel(Motion)
diff --git a/openslides/motion/templates/motion/widget.html b/openslides/motion/templates/motion/widget.html
new file mode 100644
index 000000000..c0796de89
--- /dev/null
+++ b/openslides/motion/templates/motion/widget.html
@@ -0,0 +1,34 @@
+{% load staticfiles %}
+{% load i18n %}
+{% load tags %}
+
+
+{% for motion in motions %}
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ motion.public_version.title }}
+
+ ({% trans "motion" %}
+ {% if motion.number %}
+ {{ motion.number }})
+ {% else %}
+ [{% trans "no number" %}])
+ {% endif %}
+
+{% empty %}
+ - {% trans 'No motion available.' %}
+{% endfor %}
+
+
diff --git a/openslides/motion/urls.py b/openslides/motion/urls.py
index 132a9b332..cfca9dfa0 100644
--- a/openslides/motion/urls.py
+++ b/openslides/motion/urls.py
@@ -33,6 +33,11 @@ urlpatterns = patterns('openslides.motion.views',
name='motion_edit',
),
+ url(r'^(?P\d+)/del/$',
+ 'motion_delete',
+ name='motion_delete',
+ ),
+
url(r'^(?P\d+)/version/(?P[1-9]\d*)/$',
'motion_detail',
name='motion_version_detail',
diff --git a/openslides/motion/views.py b/openslides/motion/views.py
index e867409c1..1728cc9a4 100644
--- a/openslides/motion/views.py
+++ b/openslides/motion/views.py
@@ -125,6 +125,17 @@ class MotionUpdateView(MotionMixin, UpdateView):
motion_edit = MotionUpdateView.as_view()
+class MotionDeleteView(DeleteView):
+ """
+ Delete one Motion.
+ """
+ model = Motion
+ success_url_name = 'motion_list'
+ # TODO: Check permissions
+
+motion_delete = MotionDeleteView.as_view()
+
+
class SupportView(SingleObjectMixin, QuestionMixin, RedirectView):
"""
Classed based view to support or unsupport a motion. Use
@@ -304,3 +315,11 @@ def register_tab(request):
permission=request.user.has_perm('motion.can_see_motion'),
selected=selected,
)
+
+def get_widgets(request):
+ return [Widget(
+ name='motions',
+ display_name=_('Motions'),
+ template='motion/widget.html',
+ context={'motions': Motion.objects.all()},
+ permission_required='projector.can_manage_projector')]