diff --git a/openslides/motion/models.py b/openslides/motion/models.py
index 6f42211bc..7f8351c51 100644
--- a/openslides/motion/models.py
+++ b/openslides/motion/models.py
@@ -88,7 +88,11 @@ class Motion(SlideMixin, AbsoluteUrlMixin, models.Model):
"""
Return a human readable name of this motion.
"""
- return self.get_active_version().title
+ if self.identifier:
+ string = '%s | %s' % (self.identifier, self.title)
+ else:
+ string = self.title
+ return string
# TODO: Use transaction
def save(self, use_version=None, *args, **kwargs):
@@ -457,14 +461,12 @@ class Motion(SlideMixin, AbsoluteUrlMixin, models.Model):
"""
Return a title for the agenda.
"""
- return self.title
+ return unicode(self)
def get_agenda_title_supplement(self):
"""
Returns the supplement to the title for the agenda item.
"""
- if self.identifier:
- return '(%s %s)' % (_('Motion'), self.identifier)
return '(%s)' % _('Motion')
def get_allowed_actions(self, person):
diff --git a/openslides/motion/pdf.py b/openslides/motion/pdf.py
index 442c2af67..39bcc8093 100644
--- a/openslides/motion/pdf.py
+++ b/openslides/motion/pdf.py
@@ -36,10 +36,10 @@ def motion_to_pdf(pdf, motion):
"""
Create a PDF for one motion.
"""
- identifier = ""
+ identifier = ''
if motion.identifier:
- identifier = " %s" % motion.identifier
- pdf.append(Paragraph(_("Motion") + "%s: %s" % (identifier, motion.title), stylesheet['Heading1']))
+ identifier = ' %s' % motion.identifier
+ pdf.append(Paragraph('%s%s: %s' % (_('Motion'), identifier, motion.title), stylesheet['Heading1']))
motion_data = []
@@ -256,10 +256,10 @@ def all_motion_cover(pdf, motions):
pdf.append(Paragraph(_("No motions available."), stylesheet['Heading3']))
else:
for motion in motions:
- identifier = ""
+ identifier = ''
if motion.identifier:
- identifier = "%s " % motion.identifier
- pdf.append(Paragraph("%s %s" % (identifier, motion.title), stylesheet['Heading3']))
+ identifier = ' %s' % motion.identifier
+ pdf.append(Paragraph('%s%s: %s' % (_('Motion'), identifier, motion.title), stylesheet['Heading3']))
def motion_poll_to_pdf(pdf, poll):
diff --git a/openslides/motion/templates/motion/widget_motion.html b/openslides/motion/templates/motion/widget_motion.html
index 865022f8b..4a03c87f2 100644
--- a/openslides/motion/templates/motion/widget_motion.html
+++ b/openslides/motion/templates/motion/widget_motion.html
@@ -22,7 +22,6 @@
- {{ motion.identifier|add:' | '|default:'' }}
{{ motion }}
diff --git a/tests/motion/test_models.py b/tests/motion/test_models.py
index 0c76b2d27..1e6d30ec1 100644
--- a/tests/motion/test_models.py
+++ b/tests/motion/test_models.py
@@ -138,10 +138,14 @@ class ModelTest(TestCase):
self.assertEqual(motion.versions.count(), 2)
def test_unicode_with_no_active_version(self):
- motion = Motion.objects.create(title='foo', text='bar', identifier='')
+ motion = Motion.objects.create(
+ title='test_title_Koowoh1ISheemeey1air',
+ text='test_text_zieFohph0doChi1Uiyoh',
+ identifier='test_identifier_VohT1hu9uhiSh6ooVBFS')
motion.active_version = None
motion.save(update_fields=['active_version'])
- self.assertEqual(str(motion), 'foo') # motion.__unicode__() raised an AttributeError
+ # motion.__unicode__() raised an AttributeError
+ self.assertEqual(str(motion), 'test_identifier_VohT1hu9uhiSh6ooVBFS | test_title_Koowoh1ISheemeey1air')
class ConfigTest(TestCase):