Пример #1
0
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)
Пример #2
0
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)
Пример #3
0
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')
Пример #4
0
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')