Commit 2ec0e10a authored by Michal Čihař's avatar Michal Čihař

Merge remote-tracking branch 'origin/master'

parents 6b5f6cf7 90e996a3
...@@ -141,7 +141,9 @@ def show_subproject(request, project, subproject): ...@@ -141,7 +141,9 @@ def show_subproject(request, project, subproject):
@permission_required('trans.automatic_translation') @permission_required('trans.automatic_translation')
def auto_translation(request, project, subproject, lang): def auto_translation(request, project, subproject, lang):
obj = get_object_or_404(Translation, language__code = lang, subproject__slug = subproject, subproject__project__slug = project) obj = get_object_or_404(Translation, language__code = lang, subproject__slug = subproject, subproject__project__slug = project)
obj.commit_pending()
autoform = AutoForm(obj, request.POST) autoform = AutoForm(obj, request.POST)
change = None
if autoform.is_valid(): if autoform.is_valid():
units = obj.unit_set.all() units = obj.unit_set.all()
if not autoform.cleaned_data['overwrite']: if not autoform.cleaned_data['overwrite']:
...@@ -161,6 +163,8 @@ def auto_translation(request, project, subproject, lang): ...@@ -161,6 +163,8 @@ def auto_translation(request, project, subproject, lang):
update = update[0] update = update[0]
unit.fuzzy = update.fuzzy unit.fuzzy = update.fuzzy
unit.target = update.target unit.target = update.target
if change is None:
change = Change.objects.create(unit = self, user = request.user)
unit.save_backend(request, False, False) unit.save_backend(request, False, False)
messages.add_message(request, messages.INFO, _('Automatic translation completed.')) messages.add_message(request, messages.INFO, _('Automatic translation completed.'))
else: else:
......
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