Commit 1996082a authored by Michal Čihař's avatar Michal Čihař

Save suggestions

parent 6b4a616d
......@@ -5,7 +5,7 @@ from django.conf import settings
from django.http import HttpResponseRedirect
from django.contrib import messages
from trans.models import Project, SubProject, Translation, Unit
from trans.models import Project, SubProject, Translation, Unit, Suggestion
from trans.forms import TranslationForm
import logging
......@@ -65,8 +65,12 @@ def translate(request, project, subproject, lang):
try:
unit = Unit.objects.get(checksum = form.cleaned_data['checksum'], translation = obj)
if 'suggest' in request.POST:
# FIXME: implement suggestions
pass
Suggestion.objects.create(
target = form.cleaned_data['target'],
checksum = unit.checksum,
language = unit.translation.language,
project = unit.translation.subproject.project,
user = request.user)
elif not request.user.is_authenticated():
messages.add_message(request, messages.ERROR, _('You need to login to be able to save translations!'))
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