def post(self): code = self.request.path.split('/')[-2] original = self.request.get('original') suggestion = self.request.get('suggestion') if not code in translations: raise Exception('Unknown language code') current_user = get_current_youtify_user() translation = Translation(text=suggestion, user=current_user) phrase = Phrase.all().filter(original=original) if phrase is None and users.is_current_user_admin(): phrase = Phrase(original=original) suggestions = getattr(phrase, code) suggestions.append(suggestion) phrase.save()