From 01f3e8176fd114d5bcc98dc53151f5e3a2b74f53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 1 Mar 2012 11:50:07 +0100 Subject: [PATCH] Stay on unit after handling suggestion --- trans/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/trans/views.py b/trans/views.py index ae694d994..4460aa5fc 100644 --- a/trans/views.py +++ b/trans/views.py @@ -102,12 +102,14 @@ def translate(request, project, subproject, lang): suggestion.delete() else: messages.add_message(request, messages.ERROR, _('Invalid suggestion!')) - return HttpResponseRedirect('%s?type=%s&oldpos=%d' % (obj.get_translate_url(), rqtype, pos)) + return HttpResponseRedirect('%s?type=%s&oldpos=%d&dir=stay' % (obj.get_translate_url(), rqtype, pos)) # If we failed to get unit above or on no POST if unit is None: # What unit to show - if direction == 'back': + if direction == 'stay': + units = obj.unit_set.filter(position = pos) + elif direction == 'back': units = obj.unit_set.filter_type(rqtype).filter(position__lt = pos) else: units = obj.unit_set.filter_type(rqtype).filter(position__gt = pos)