From 2c6c9b55eea0a182b97c314af0ae2da4a2837c9a Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Sun, 4 Sep 2011 10:02:54 +0200 Subject: [PATCH] accept old application versions --- openslides/application/models.py | 9 ++++----- openslides/application/views.py | 7 ++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/openslides/application/models.py b/openslides/application/models.py index b386663be..e45215fb1 100644 --- a/openslides/application/models.py +++ b/openslides/application/models.py @@ -66,11 +66,10 @@ class Application(models.Model): """ accept a Version """ - if version.id > self.permitted.id: - self.permitted = version - self.save() - return True - return False + self.permitted = version + self.save() + version.rejected = False + version.save() def reject_version(self, version): if version.id > self.permitted.id: diff --git a/openslides/application/views.py b/openslides/application/views.py index 69fc77ea8..416121427 100644 --- a/openslides/application/views.py +++ b/openslides/application/views.py @@ -128,7 +128,7 @@ def edit(request, application_id=None): messages.success(request, _('New application was successfully created.')) else: messages.success(request, _('Application was successfully modified.')) - + if not 'apply' in request.POST: return redirect(reverse('application_view', args=[application.id])) if application_id is None: @@ -362,10 +362,7 @@ def view_poll(request, poll_id): def permit_version(request, aversion_id): aversion = AVersion.objects.get(pk=aversion_id) application = aversion.application - if application.accept_version(aversion): - messages.success(request, _("Version accepted") ) - else: - messages.error(request, _("ERROR by accepting the Version") ) + messages.success(request, _("Version accepted") ) return redirect(reverse('application_view', args=[application.id]))