Commit 47be0c28 authored by Michal Čihař's avatar Michal Čihař

Check authenticated user on save, prepare for suggestions

parent d70dc6a0
...@@ -64,9 +64,15 @@ def translate(request, project, subproject, lang): ...@@ -64,9 +64,15 @@ def translate(request, project, subproject, lang):
obj.check_sync() obj.check_sync()
try: try:
unit = Unit.objects.get(checksum = form.cleaned_data['checksum'], translation = obj) unit = Unit.objects.get(checksum = form.cleaned_data['checksum'], translation = obj)
unit.target = form.cleaned_data['target'] if 'suggest' in request.POST:
unit.fuzzy = form.cleaned_data['fuzzy'] # FIXME: implement suggestions
unit.save_backend(request) pass
elif not request.user.is_authenticated():
messages.add_message(request, messages.ERROR, _('You need to login to be able to save translations!'))
else:
unit.target = form.cleaned_data['target']
unit.fuzzy = form.cleaned_data['fuzzy']
unit.save_backend(request)
# Check and save # Check and save
return HttpResponseRedirect('%s?type=%s&oldpos=%d' % (obj.get_translate_url(), rqtype, pos)) return HttpResponseRedirect('%s?type=%s&oldpos=%d' % (obj.get_translate_url(), rqtype, pos))
......
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