Save suggestions
This commit is contained in:
parent
6b4a616d08
commit
1996082a71
@ -5,7 +5,7 @@ from django.conf import settings
|
|||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.contrib import messages
|
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
|
from trans.forms import TranslationForm
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -65,8 +65,12 @@ def translate(request, project, subproject, lang):
|
|||||||
try:
|
try:
|
||||||
unit = Unit.objects.get(checksum = form.cleaned_data['checksum'], translation = obj)
|
unit = Unit.objects.get(checksum = form.cleaned_data['checksum'], translation = obj)
|
||||||
if 'suggest' in request.POST:
|
if 'suggest' in request.POST:
|
||||||
# FIXME: implement suggestions
|
Suggestion.objects.create(
|
||||||
pass
|
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():
|
elif not request.user.is_authenticated():
|
||||||
messages.add_message(request, messages.ERROR, _('You need to login to be able to save translations!'))
|
messages.add_message(request, messages.ERROR, _('You need to login to be able to save translations!'))
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user