def data_enter(): form = TextForm() if form.validate_on_submit(): title = request.form['title'] text = request.form['text'] signature = Something(title=title, text=text) db.session.add(signature) db.session.commit() return redirect('/list') return render_template('data_enter.html', form=form)
def add_text(board_slug): print 'add_text: ', board_slug board = Board.query.filter_by(slug=board_slug).first() if not board: abort(404) form = TextForm() if form.validate_on_submit(): response_data = process_text(board, form.text.data) db.session.commit() return json_success(response_data) return json_error_message('Failed to create color', error_data=form.errors)
def text(): form = TextForm() dform = DownloadForm() if form.validate_on_submit(): algo = form.algo.data text = form.text.data num = form.sentences.data result = select_algorithm(algo, text, num) return render_template('text_input.html', title='Text', results=result, form=form, dform=dform) return render_template('text_input.html', title='Text', form=form)
def index(): global text, delimiter form = TextForm() if form.validate_on_submit(): text = form.text.data delimiter = form.delimiters.data operation = form.operations.data operation_name = None if (operation == 'a'): operation_name = 'wordcount' elif (operation == 'b'): operation_name = 'charactercount' elif (operation == 'c'): operation_name = 'mostfrequent5words' return redirect(url_for('showresult', operationname=operation_name)) return render_template('index.html', title='Home', form=form)