예제 #1
0
def Review_Extraction():
    name = None
    form = NameForm()
    if form.validate_on_submit():

        name = form.name.data

        old_width = pandas.get_option('display.max_colwidth')
        pandas.set_option('display.max_colwidth', -1)

        df = review_content.review_fc(name)
        form.name.data = ''
        columns = ['Person', 'SBV', 'speech_content', 'sentence']
        return render_template('review_extraction.html',
                               title='Zh_Cola',
                               form=form,
                               tables=[
                                   df.to_html(classes='data',
                                              escape=True,
                                              index=True,
                                              sparsify=False,
                                              border=1,
                                              index_names=False,
                                              header=True,
                                              columns=columns)
                               ],
                               titles=df.columns.values)

        pandas.set_option('display.max_colwidth', old_width)
    else:
        return render_template('review_extraction.html',
                               title='Zh_Cola',
                               form=form)
예제 #2
0
def index():
    name = None
    form = NameForm()
    if form.validate_on_submit():
        name = form.name.data
        form.name.data = ''
    return render_template('123.html', form=form, name=name)
예제 #3
0
def index():
    form = NameForm()
    if form.validate_on_submit():
        # Create new db entry for current game session with name. Or can do this at the end.
        session['name'] = form.name.data
        session['score'] = 0
        return redirect(url_for("play"))
    return render_template("enter-name.html", form=form)
예제 #4
0
def GetCustomer():
    form = NameForm()

    if form.validate_on_submit():
        full_name = form.full_name.data
        customer = Customer.query.filter_by(full_name=full_name).first()
        search_cust_id = customer.cust_id
        return redirect(url_for('result', search_cust_id=search_cust_id))

    return render_template('form.html', title='Get Customer', form=form)
예제 #5
0
def index():
    name = None
    form = NameForm()

    if form.validate_on_submit():
        name = form.name.data
        print(form.name.data)
        form.name.data = ""
        return redirect(url_for("user", name=name))

    return render_template("index.html", form=form, name=name)
예제 #6
0
def form():
    form = NameForm()
    if request.method == 'POST':
        if form.validate_on_submit():
            name = request.form['name']
            surname = request.form['surname']
            age = request.form['age']
            user = Name(name=name, surname=surname, age=age)
            db.session.add(user)
            db.session.commit()
            return redirect(url_for('home'))
    return render_template('nameform.htm', form=form)
예제 #7
0
def hello():
    form = NameForm()

    if form.validate_on_submit():
        user = User()
        form.populate_obj(user)
        db.session.add(user)
        db.session.commit()
        return redirect("")

    data = User.query.all()
    return render_template('bootstrap-form.html', form=form, data=data)
예제 #8
0
def charAdder():
    form = NameForm()
    if form.validate_on_submit():
        nameGen.titles.append(form.title.data)
        nameGen.names.append(form.name.data)
        nameGen.descriptors.append(form.descriptor.data)
        flash('Added {} {} the {}'.format(form.name.data, form.title.data,
                                          form.descriptor.data))
        return redirect('/index')
    return render_template('charadder.html',
                           title='Character Adder',
                           form=form)