def ask_create_contact(): try: contacts.create_contact(e_name.get(), e_phone.get()) clear_entries() tkMessageBox.showinfo("Success", "Contact added") except ValueError as e: tkMessageBox.showerror("Error", e)
def add(): if request.method == 'POST': try: contacts.create_contact(request.form['name'], request.form['phone']) session['message'] = "Contact added" return redirect('/') except ValueError as e: return render_template('add.html', message=e, name=request.form['name'], phone=request.form['phone']) return render_template('add.html')
def add(): if request.method == 'POST': try: contacts.create_contact(request.form['name'], request.form['phone']) session['message'] = "Contact added" return redirect('/') except ValueError as e: return render_template( 'add.html', message=e, name=request.form['name'], phone=request.form['phone'] ) return render_template('add.html')