Check authenticated user on save, prepare for suggestions

This commit is contained in:
Michal Čihař 2012-02-29 15:22:00 +01:00
parent d70dc6a0e5
commit 47be0c2877

View File

@ -64,9 +64,15 @@ def translate(request, project, subproject, lang):
obj.check_sync()
try:
unit = Unit.objects.get(checksum = form.cleaned_data['checksum'], translation = obj)
unit.target = form.cleaned_data['target']
unit.fuzzy = form.cleaned_data['fuzzy']
unit.save_backend(request)
if 'suggest' in request.POST:
# FIXME: implement suggestions
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
return HttpResponseRedirect('%s?type=%s&oldpos=%d' % (obj.get_translate_url(), rqtype, pos))