示例#1
0
def Insert_question():
    q = Question(subject='이것은 무엇인가요?',
                 content='알려주세요 궁금합니다.',
                 create_date=datetime.now())
    q.subject = '[질문]이것은 무엇일까요?'
    db.session.add(q)
    db.session.commit()
    return 'Sucess'
def add_question():
    q = Question(subject='궁금합니다~~',
                 content='무엇이 궁금한지 알려주세요',
                 create_date=datetime.now())
    db.session.add(q)
    db.session.commit()
    return 'Success'
示例#3
0
def test():
    for i in range(300):
        q = Question(subject='테스트 데이터입니다. {0}'.format(i),
                     content='내용무',
                     create_date=datetime.now())
        db.session.add(q)
    db.session.commit()
    return 'success'
示例#4
0
def create():
    form = QuestionForm()

    if request.method == 'POST' and form.validate_on_submit():
        question = Question(subject=form.subject.data, content=form.content.data, create_date=datetime.now(), user=g.user)
        db.session.add(question)
        db.session.commit()
        return redirect(url_for('main.index'))

    return render_template('question/question_form.html', form=form)