diff --git a/app.py b/app.py index 9ef1de2..c7fb3e6 100644 --- a/app.py +++ b/app.py @@ -55,8 +55,13 @@ def edit_contact(id): :param id: Id from contact ''' - form = ContactForm() my_contact = Contact.query.filter_by(id=id).first() + form = ContactForm( + name=my_contact.name, + surname=my_contact.surname, + email=my_contact.email, + phone=my_contact.phone + ) if form.validate_on_submit(): # Get form name = form.name.data @@ -79,8 +84,7 @@ def edit_contact(id): flash('Error update contact.', 'danger') return render_template( 'web/edit_contact.html', - form=form, - my_contact=my_contact) + form=form) @app.route("/contacts") @@ -108,8 +112,6 @@ def search(): def contacts_delete(): ''' Delete contact - - :param id: Id from contact ''' try: mi_contacto = Contact.query.filter_by(id=request.form['id']).first() diff --git a/book.sqlite b/book.sqlite new file mode 100644 index 0000000..8cc4546 Binary files /dev/null and b/book.sqlite differ diff --git a/templates/web/edit_contact.html b/templates/web/edit_contact.html index 5842ef0..dd177fb 100644 --- a/templates/web/edit_contact.html +++ b/templates/web/edit_contact.html @@ -4,34 +4,17 @@