def index(): if request.method == 'GET': pass if request.method == 'POST': username = request.form.get('username') content = request.form.get('content') create_post(username, content) posts = get_posts() return
def post(self): email = get_user_email() if email: text = self.request.get('comment') location = self.request.get('location') models.create_post(email,text,location) self.redirect('/')
def store_microblog_post(request, path): if request.method == 'POST': if request.user.is_authenticated: create_post(request.POST['microBlogText'], request.user) return json_response({}) else: return json_error_response('Authentification reqired',"You need to be authenticated to store microblogging.") else: return json_error_response('Wrong method',"You must send a POST request to store microblogging.")
def index(): if request.method == 'GET': pass if request.method == 'POST': name = request.form.get('name') post = request.form.get('post') create_post(name, post) posts = get_posts() return render_template('index.html', posts=posts)
def add_post(user_id): title = request.form['post-title'] content = request.form['post-content'] tags = request.form.getlist('tagcheckboxes') create_post(title, content, user_id, tags) return redirect(f"/users/{user_id}")
def postReserve(): if request.method == 'POST': datesNum = request.form.get('datesnum') fname = request.form.get('fname') lname = request.form.get('lname') email = request.form.get('email') create_post(datesNum, fname, lname, email) return redirect(url_for('index'))
def index(): if request.method == "GET": pass if request.method == "POST": name = request.form.get("name") post = request.form.get("post") create_post(name, post) posts = get_posts() return render_template("index.html", posts=posts)
def index(): if request.method == 'GET': pass # user is posting information into an input field if request.method == 'POST': name = request.form.get('name') post = request.form.get('post') create_post(name, post) posts = get_posts() # everytime the user updates with a new post it'll be updated return render_template('index.html', posts=posts)
def home(): if request.method == 'GET': pass if request.method == 'POST': global posts username = request.form.get('username') post_content = request.form.get('post_content') create_post(username, post_content) posts = get_post() return render_template('home.html', post=posts)
def process(): if request.method == 'POST': user_input = request.form['user_input'] bot_response = bot.get_response(user_input) bot_response = str(bot_response) #nameb = 'Assistant' create_post(user_input, bot_response) print("Friend: " + bot_response) posts = get_posts() return render_template('index.html', posts=posts)
def index(): if request.method == 'GET': pass if request.method == 'POST': name = request.form.get('name') post = request.form.get('post') #mehod for server to interact with the database create_post(name, post) posts = get_posts() return render_template('index.html', posts=posts)
def index(): if request.method == 'GET': pass if request.method == 'POST': name = request.form.get('name') post = request.form.get('post') create_post(name, post) #calling get_posts() function is models.py posts = get_posts() #create a variable posts and setting it to posts so it reflects new posts return render_template('index.html', posts=posts)
def index(): if request.method == 'GET': pass if request.method == 'POST': name = request.form.get('name') post = request.form.get('post') create_post(name, post) posts = get_posts() #rerender template any time we get new posts #tempalte will access posts passed in return render_template('index.html', posts=posts)
def process(): global flag global flag_id global toadd if request.method == 'POST': user_input=request.form['user_input'] if (len(re.compile(r"\bbye\b",re.I).findall(user_input))): print('ChatBot: Bye') bot_response = 'Bye' return render_template('bye.html', title='Bye') if (len(re.compile(r"\bmail\b",re.I).findall(user_input))!=0): bot_response = 'Whom do you want to sent the mail' create_post(user_input, bot_response) flag = 1 posts = get_posts() return render_template('index.html',posts=posts) if (len(re.compile(r"[^@]+@[^@]+\.[^@]+",re.I).findall(user_input))!=0 and flag == 1): flag = 2 toadd = user_input print(user_input) bot_response = 'What do you want to attach in the mail use @@ followed by 1)Resume 2)PAN 3)ADHAR 4)Resignation Letter' create_post(user_input, bot_response) posts = get_posts() return render_template('index.html',posts=posts) # else: # print('try again with some correct email') # bot_response = 'try again with some correct email' # create_post(user_input, bot_response) # posts = get_posts() # return render_template('index.html',posts=posts) if len(re.compile(r"@@",re.I).findall(user_input))!=0: flag_id = user_input[2:] print(flag_id) sent_mail(toadd,flag_id) flag = 0 flag_id = 0 bot_response = 'Hold on I am sending it' create_post(user_input, bot_response) posts = get_posts() return render_template('index.html',posts=posts) bot_response=bot.get_response(user_input) bot_response=str(bot_response) #nameb = 'Assistant' create_post(user_input, bot_response) print("Friend: "+bot_response) posts = get_posts() return render_template('index.html',posts=posts)
def chat(): if request.method == 'GET': pass if request.method == 'POST': #name = request.form.get('name') name = session['user'] post = request.form.get('post') create_post(name, post) posts = get_posts() if g.user: return render_template('chat.html', posts=posts) return redirect(url_for('home'))
def index(): #when the user request infon from our db or website if request.method == "GET": posts = get_posts() #when the user is sending data back to the server or db if request.method == "POST": name=request.form.get("name") post=request.form.get("post") create_post(name, post) posts = get_posts() return render_template("index.html", posts=posts)
def POST(self): form = self.add_form() if not form.validates(): return render.add(form) else: act = models.create_post(form.d.title, form.d.description) actions.insert(act) raise web.seeother("/add/")
def create_post(): postContents = request.form['postContents'] createOption = request.form['createOption'] if not (postContents and createOption): abort(400) if createOption == "createAndPublish": publish = True else: publish = False models.create_post(postContents, publish) if publish: return redirect("/posts") else: return redirect("/unpublished_posts")
def index(): if request.method == 'POST': name = request.form.get('name') post = request.form.get('post') create_post(name, post) post = get_posts() posts = [] for po in post: posts.append((po['userName'], po['userPost'])) #jposts = jsonify(posts['userName'], posts['userPost']) return render_template('index.html', posts=posts) if request.method == 'GET': post = get_posts() posts = [] for po in post: posts.append((po['userName'], po['userPost'])) return render_template('index.html', posts=posts)
def index(): if request.method == 'GET': pass if request.method == 'POST': if request.form['submit'] == 'postit': name = request.form.get('name') post = request.form.get('post') time = datetime.now().strftime('%H:%M') create_post(name, post, time) elif request.form['submit'] == 'clear': clear_posts() else: pass posts = get_posts() return render_template('index.html', posts=posts)
def post_create(param,where,cate): category_data = models.category_data() form = create_post() if form.validate_on_submit(): give_title = request.form['title'] giv_des = request.form['post_des'] give_select = request.form['select'] give_content = request.form['editor1'] give_is_recommend = form.recommend.data now = datetime.datetime.now() give_time = now.strftime('%Y-%m-%d %H:%M:%S') give_author = 'Vpanda' if give_content != '' and give_title != '' and giv_des != '': models.create_post(give_title, giv_des, give_content,give_author,give_time,give_select,give_is_recommend) models.category_data_add() return redirect('/admin/post/') else: flash('不能有空内容') return redirect('/admin/post/create/') return render_template('post_create.html',state=True,params_dict=params_dict,category_data=category_data,form=form)
def post(self): if users.is_current_user_admin(): title = self.request.get('title') content = self.request.get('content') if title and content: post_id = models.create_post(title, content) return webapp2.redirect('/view-post?id=' + post_id) else: webapp2.abort(400) else: webapp2.abort(403)
def getAllPosts(): # if request.method == 'GET': # pass if request.method == 'POST': name = request.form.get('name') post = request.form.get('post') create_post(name, post) posts = get_posts() posts_l = [] posts_d = {} for post in posts: posts_d["id"] = post[0] # posts_d["user_id"] = post[0] posts_d["username"] = post[1] posts_d["content"] = post[2] posts_d["likes"] = post[3] posts_l.append(posts_d) posts_d = {} jsonString = json.dumps(posts_l) return '{"list":' + jsonString + "}"
def store_microblog_post(request, path): assert_authentication(request) assert_post_parameters(request, ['microblogText']) create_post(request.POST['microblogText'], request.user, path) return json_response({'storeMicrobloggingResponse': {}})