Commit d0287b31 authored by Michal Čihař's avatar Michal Čihař

Make unit based links work

parent 89378a86
......@@ -409,12 +409,19 @@ def translate(request, project, subproject, lang):
return response
# Grab actual unit
try:
unit = obj.unit_set.get(pk=search_result['ids'][offset])
except Unit.DoesNotExist:
# Can happen when using SID for other translation
messages.error(request, _('Invalid search string!'))
return HttpResponseRedirect(obj.get_absolute_url())
if 'checksum' in request.GET:
try:
unit = obj.unit_set.get(checksum=request.GET['checksum'])
except Unit.DoesNotExist:
unit = None
if unit is None:
try:
unit = obj.unit_set.get(pk=search_result['ids'][offset])
except Unit.DoesNotExist:
# Can happen when using SID for other translation
messages.error(request, _('Invalid search string!'))
return HttpResponseRedirect(obj.get_absolute_url())
# Show secondary languages for logged in users
if request.user.is_authenticated():
......
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