Stay on unit after handling suggestion

This commit is contained in:
Michal Čihař 2012-03-01 11:50:07 +01:00
parent a15aa721f9
commit 01f3e8176f

View File

@ -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)