def addsen(): word = request.form['word'] en = request.form['en'] ch = request.form['ch'] item = dict.searchWord(word) item['examples'].append({'sentence':en, 'translation': ch}) return dict.modifyWord(item)
def delsen(): word = request.form['word'] num = request.form['num'] n = int(num) - 1 item = dict.searchWord(word) del item['examples'][n] return dict.modifyWord(item)
def modifysen(): word = request.form['word'] num = request.form['num'] en = request.form['en'] ch = request.form['ch'] item = dict.searchWord(word) item['examples'][int(num) - 1]['sentence'] = en item['examples'][int(num) - 1]['translation'] = ch return dict.modifyWord(item)