def post_forum(): if 'username' in session: form = forumForm(request.form) retrieve_forum_count = root.child('forumCount').get() forumCount = int(retrieve_forum_count['forumCount']) if request.method == 'POST': text = form.forumText.data type = form.forumType.data newForum = Forum(text, type) increaseCount = forumCount + 1 newCount = root.child('forumCount/forumCount').set(increaseCount) newForum_db = root.child('Forum') newForum_db.push({ 'count': str(increaseCount), 'text': newForum.get_text(), 'type': newForum.get_type(), 'time': newForum.get_date(), 'username': session['username'], 'response': { 'response': 'empty' }, 'responseCount': 0 }) return redirect(url_for('forum')) return render_template('postForum.html', form=form) else: return redirect(url_for('login'))
def post_forum(): form = forumForm(request.form) if request.method == 'POST': text = form.forumText.data type = form.forumType.data newForum = Forum(text,type) newForum_db = root.child('Forum') newForum_db.push( { 'text' : newForum.get_text(), 'type' : newForum.get_type(), 'time' : newForum.get_date() }) return redirect(url_for('forum')) return render_template('postForum.html',form=form)