Merge pull request #3318 from normanjaeckel/CategorySortError

Fixed error on category numbering. Fixed #3315.
This commit is contained in:
Emanuel Schütze 2017-07-26 14:41:27 +02:00 committed by GitHub
commit a44b84e836
2 changed files with 12 additions and 5 deletions

View File

@ -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].

View File

@ -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.
# 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