def add(): """Show form to add new pet""" form = AddPetForm() if form.validate_on_submit(): name = form.name.data species = form.species.data photo_url = form.photo_url.data age = form.age.data notes = form.notes.data new_pet = Pet(name=name, species=species, photo_url=photo_url, age=age, notes=notes) Pet.add_new_pet(new_pet) flash(f"Added {name} to listings") return redirect("/") else: return render_template("add_pet.html", form=form)