Commit 02991be5 authored by Michal Čihař's avatar Michal Čihař

Do not accept empty suggestions

parent 5d148871
......@@ -261,6 +261,15 @@ def translate(request, project, subproject, lang):
user = request.user
if isinstance(user, AnonymousUser):
user = None
if form.cleaned_data['target'] == len(form.cleaned_data['target']) * ['']:
messages.add_message(request, messages.ERROR, _('Your suggestion is empty!'))
# Stay on same entry
return HttpResponseRedirect('%s?type=%s&pos=%d&dir=stay%s' % (
obj.get_translate_url(),
rqtype,
pos,
search_url
))
Suggestion.objects.create(
target = join_plural(form.cleaned_data['target']),
checksum = unit.checksum,
......
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