default version is the accepted Version

This commit is contained in:
Oskar Hahn 2011-09-04 10:21:54 +02:00
parent 2c6c9b55ee
commit 572782befa
2 changed files with 7 additions and 4 deletions

View File

@ -353,13 +353,15 @@ class Application(models.Model):
if name is title, text, reason or time,
Return this attribute from the newest version of the application
"""
if name in ('title', 'text', 'reason', 'time'):
if name in ('title', 'text', 'reason', 'time', 'aid'):
try:
return self.last_version.__dict__[name]
return self.permitted.__dict__[name]
except TypeError:
raise AttributeError(name)
return self.last_version.__dict__[name]
#raise AttributeError(name)
except AttributeError:
raise AttributeError(name)
return self.last_version.__dict__[name]
#raise AttributeError(name)
raise AttributeError(name)
def gen_poll(self, user=None):

View File

@ -362,6 +362,7 @@ def view_poll(request, poll_id):
def permit_version(request, aversion_id):
aversion = AVersion.objects.get(pk=aversion_id)
application = aversion.application
application.accept_version(aversion)
messages.success(request, _("Version accepted") )
return redirect(reverse('application_view', args=[application.id]))