From 41a70f40df1b33c27903d04810ce9116c6880c7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Wed, 5 Jul 2017 22:12:32 +0200 Subject: [PATCH] Fixed error on category numbering. Fixed #3315. --- CHANGELOG | 1 + openslides/motions/models.py | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 74ce4610a..7e25d75c0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -18,6 +18,7 @@ Motions: - Fixed issue when creating/deleting motion comment fields in the settings [#3187]. - Fixed empty motion comment field in motion update form [#3194]. +- Fixed error on category sort [#3318]. - Removed server side image to base64 transformation and added local transformation [#3181] - Added support for export motions in a ZIP archive [#3189]. diff --git a/openslides/motions/models.py b/openslides/motions/models.py index 7fa52e0f6..66508af1a 100644 --- a/openslides/motions/models.py +++ b/openslides/motions/models.py @@ -233,11 +233,17 @@ class Motion(RESTModelMixin, models.Model): with transaction.atomic(): super(Motion, self).save(skip_autoupdate=True, *args, **kwargs) except IntegrityError: - # Identifier is already used. Calculate a new one and try again. - self.identifier_number, self.identifier = self.increment_identifier_number( - self.identifier_number, - self._identifier_prefix, - ) + # Identifier is already used. + if hasattr(self, '_identifier_prefix'): + # Calculate a new one and try again. + self.identifier_number, self.identifier = self.increment_identifier_number( + self.identifier_number, + self._identifier_prefix, + ) + else: + # Do not calculate a new one but reraise the IntegrityError. + # The error is caught in the category sort view. + raise else: # Save was successful. End loop. break