Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJosh Stephens
13,529 PointsFlask with SqlAlchemy Basics - Section 2 / Delete Objective incorrect [Solved]
This objective is incorrect. If I try to do the following
@app.route('/delete/<id>')
def delete(id):
plant = Plant.query.get(id)
db.session.delete(plant)
db.session.commit()
return redirect(url_for('index'))
I get the following error Bummer: After you've found your plant pass it in to db.delete() to remove it.
If you look at the official documentation it even says to do
db.session.delete(me)
db.session.commit()
where me is a reference to a DB object
The objective says that the answer should be
@app.route('/delete/<id>')
def delete(id):
plant = Plant.query.get(id)
db.delete(plant)
db.commit()
return redirect(url_for('index'))
However that does not match up with what the video's and the official documentation says