Fixed error on category numbering. Fixed #3315.

This commit is contained in:
Norman Jäckel 2017-07-05 22:12:32 +02:00
parent 77a321894b
commit 41a70f40df
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 - Fixed issue when creating/deleting motion comment fields in the
settings [#3187]. settings [#3187].
- Fixed empty motion comment field in motion update form [#3194]. - Fixed empty motion comment field in motion update form [#3194].
- Fixed error on category sort [#3318].
- Removed server side image to base64 transformation and - Removed server side image to base64 transformation and
added local transformation [#3181] added local transformation [#3181]
- Added support for export motions in a ZIP archive [#3189]. - Added support for export motions in a ZIP archive [#3189].

View File

@ -233,11 +233,17 @@ class Motion(RESTModelMixin, models.Model):
with transaction.atomic(): with transaction.atomic():
super(Motion, self).save(skip_autoupdate=True, *args, **kwargs) super(Motion, self).save(skip_autoupdate=True, *args, **kwargs)
except IntegrityError: except IntegrityError:
# Identifier is already used. Calculate a new one and try again. # Identifier is already used.
self.identifier_number, self.identifier = self.increment_identifier_number( if hasattr(self, '_identifier_prefix'):
self.identifier_number, # Calculate a new one and try again.
self._identifier_prefix, 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: else:
# Save was successful. End loop. # Save was successful. End loop.
break break