Commit d0e166db authored by BAIRE Anthony's avatar BAIRE Anthony
Browse files

when overwriting a version, display the deleted ids (if any)

parent 6dba797b
Pipeline #139134 failed with stages
in 2 seconds
...@@ -718,16 +718,20 @@ class WebappVersionUpdate(UserAccessMixin, UpdateView): ...@@ -718,16 +718,20 @@ class WebappVersionUpdate(UserAccessMixin, UpdateView):
if version.state in (WebappVersion.READY, WebappVersion.DELETED): if version.state in (WebappVersion.READY, WebappVersion.DELETED):
# delete the version that is currently READY # delete the version that is currently READY
other_versions.filter(state=WebappVersion.READY deleted_versions = other_versions.filter(state=WebappVersion.READY)
).update(state=WebappVersion.DELETED, deleted_at=django.utils.timezone.now()) deleted_ids = [v.id for v in deleted_versions]
deleted_versions.update(state=WebappVersion.DELETED, deleted_at=django.utils.timezone.now())
if version.state == WebappVersion.DELETED: if version.state == WebappVersion.DELETED:
# mark the current version as READY # mark the current version as READY
version.state = WebappVersion.READY version.state = WebappVersion.READY
version.deleted_at = None version.deleted_at = None
messages.success(self.request, "Version %s (#%d) restored" for i in deleted_ids:
% (version.number, version.id)) messages.success(self.request, "Version %s (#%d) deleted" % (version.number, i))
messages.success(self.request, "Version %s (#%d) restored" % (
version.number, version.id))
else: else:
messages.success(self.request, "Version %s (#%d) updated" messages.success(self.request, "Version %s (#%d) updated"
% (version.number, version.id)) % (version.number, version.id))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment