Fixed error on category numbering. Fixed #3315.
This commit is contained in:
parent
77a321894b
commit
41a70f40df
@ -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].
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user