From f238125a236c14d1bf727d8e255aa6ad50702221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Sch=C3=BCtze?= Date: Mon, 6 Feb 2017 12:11:50 +0100 Subject: [PATCH] Fixed motion numbering in category sort view. Removed blanks if MOTION_IDENTIFIER_WITHOUT_BLANK is True. --- openslides/motions/views.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/openslides/motions/views.py b/openslides/motions/views.py index 102033464..ba95772f2 100644 --- a/openslides/motions/views.py +++ b/openslides/motions/views.py @@ -1,6 +1,7 @@ import base64 import re +from django.conf import settings from django.contrib.staticfiles import finders from django.db import IntegrityError, transaction from django.http import Http404 @@ -426,9 +427,14 @@ class CategoryViewSet(ModelViewSet): number = 0 instances = [] + # If MOTION_IDENTIFIER_WITHOUT_BLANKS is set, don't use blanks when building identifier. + without_blank = hasattr(settings, 'MOTION_IDENTIFIER_WITHOUT_BLANKS') and settings.MOTION_IDENTIFIER_WITHOUT_BLANKS + # Prepare ordered list of motions. if not category.prefix: prefix = '' + elif without_blank: + prefix = '%s' % category.prefix else: prefix = '%s ' % category.prefix motions = category.motion_set.all() @@ -447,7 +453,10 @@ class CategoryViewSet(ModelViewSet): for motion in motions: if motion.is_amendment(): parent_identifier = motion.parent.identifier or '' - prefix = '%s %s ' % (parent_identifier, config['motions_amendments_prefix']) + if without_blank: + prefix = '%s%s' % (parent_identifier, config['motions_amendments_prefix']) + else: + prefix = '%s %s ' % (parent_identifier, config['motions_amendments_prefix']) number += 1 new_identifier = '%s%s' % (prefix, motion.extend_identifier_number(number)) motions_to_be_sorted.append({