Jul-18-2020, 05:09 PM
Hi coders! I'm dividing every page by filtering by the correct category in my recipe blog, but I don't know why I cannot manage. For example, I have vegetarian.html, It works when I simply don't look for a specific category in MongoDB, but when I do I get an error, I write here the code:
This is main.py
File "/Users/RBianco/Desktop/Course restart/cookbook-milestone/main.py", line 35, in vegetarian
query={{"category_name": "Vegetarian"}}
TypeError: unhashable type: 'dict'
For sure I wrote it wrong.
Any help please?
Thank you guys!!!
This is main.py
@app.route('/vegetarian') def vegetarian(): query={{"category_name": "Vegetarian"}} return render_template("vegetarian.html", recipes=mongo.db.recipes.find(query))The error is this:
File "/Users/RBianco/Desktop/Course restart/cookbook-milestone/main.py", line 35, in vegetarian
query={{"category_name": "Vegetarian"}}
TypeError: unhashable type: 'dict'
For sure I wrote it wrong.
Any help please?
Thank you guys!!!