def guestbook(): if request.method == 'POST': if request.form['submit'] == 'delete': selected_entries = request.form.getlist("delcomments") for entry in selected_entries: with AzureDB() as a: a.azureDeleteData(entry) with AzureDB() as a: data = a.azureGetData() return render_template("guestbook.html", data=data, mode='delete') else: name = request.form['name'] text = request.form['comments'] with AzureDB() as a: a.azureAddData(name, text) data = a.azureGetData() return render_template("guestbook.html", data=data) else: user = request.args.get('user') if user == 'panda': with AzureDB() as a: data = a.azureGetData() return render_template("guestbook.html", data=data, mode='delete') else: with AzureDB() as a: data = a.azureGetData() return render_template("guestbook.html", data=data)
def edit_comm(id): comm = AzureDB().azureGetDataid(id) if request.method == "POST": if len(request.form['text']) > 5: res = AzureDB().azureEditData(request.form['text'], id) return redirect('/comments') else: return 'Nie możesz zostawić pusty komentarz!' else: return render_template('edit.html', comm=comm)
def delete(): index = request.form['id'] with AzureDB() as a: a.azureDeleteData(index) return render_template('thankyou.html', title='Dziękuje', metod='DELETE')
def update_comment(comment_id): if request.method == 'PUT': data = request.json text = data['text'] with AzureDB() as a: a.azureUpdateData(comment_id, text) return 200
def thankyou(): if request.method == 'POST': name = request.form['name'] comment = request.form['comment'] date = str(datetime.now()) with AzureDB() as a: a.azureAddData(name, comment, date[:19]) return render_template('thankyou.html', title='Dziękuje', metod='POST')
def update(): index = request.form['id'] name = request.form['name'] text = request.form['text'] with AzureDB() as a: a.azureUpdateData(index, name, text) return render_template('thankyou.html', title='Dziękuje', metod='UPDATE')
def edit(): index = request.form['id'] with AzureDB() as a: data = a.azureGetOneData(index) return render_template('editcomment.html', title='Edytowanie', nick=data[1], comment=data[2], id=data[0])
def comment(): if request.method == 'POST': text = request.form['comment'] nick = request.form['nick'] date = str(datetime.datetime.now())[:19] print(date) with AzureDB() as a: a.azureAddData(nick, text, date) return redirect('guestBook')
def contact(): if request.method == "POST": if len(request.form['name']) > 2 and len( request.form['mail']) > 3 and len(request.form['text']) > 5: res = AzureDB().azureAddData(request.form['name'], request.form['mail'], request.form['text']) flash('Comentarz został wysłąny', category='success') else: flash('Niepoprawna forma komentarza, sprawdz', category='error') return render_template('contact.html')
def guestbook(): with AzureDB() as a: data = a.azureGetData() return render_template("guestbook.html", data=data, title='GuestBook')
from AzureDB import AzureDB #AzureDB().azureAddData() #AzureDB().azureDeleteData() with AzureDB() as a: data = a.azureGetData() for result in data: print("%s napisał : \"%s\"" % (result['name'], result['text']))
def delete_comm(id): AzureDB().azureDeleteData(id) return redirect('/comments')
def comments(): data = AzureDB().azureGetData() return render_template("comments.html", data=data)
def delete_comment(comment_id): if request.method == 'DELETE': with AzureDB() as a: a.azureDeleteData(comment_id) return str('Hello')
def get_guest_book(): with AzureDB() as a: data = a.azureGetData() print(data) return render_template("book.html", data=data)