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 trialCross Ender
9,567 PointsI'm simplicitly stuck here.
.
from models import Challenge
def create_challenge(name, language, steps=1):
Challenge.create(name=name,
language=language,
steps=steps)
def search_challenges(name, languge):
return Challenge.where(Challenge.name.contains(name)
Ken LaRose
Python Web Development Techdegree Student 21,982 PointsI am also stuck on this code challenge. I believe there are some syntax errors in your search_challenges function. But, then again, my function isn't working either.... check out the peewee documentation here: http://docs.peewee-orm.com/en/latest/peewee/querying.html#filtering-records
This is what I wrote:
def search_challenges(name, language):
challenges = Challenge.select().where(Challenge.name == name,
Challenge.language == language)
return challenges
if I figure it out, I'll post a follow-up comment
2 Answers
Christopher Shaw
Python Web Development Techdegree Graduate 58,248 PointsThere are a few hints in the question, i.e, it asks for equal and says use the == as well as put both arguments in the where()
Ken LaRose
Python Web Development Techdegree Student 21,982 Pointsokay... I figured it out. The query I posted in the comments above failed because it was searching for an exact match on name instead of using contains(). That's not your issue though. Basically you'll just want to insert the select() method between Challenge and where(), like Challenge.select().where(blah, blah)
. You're on the right track!
nicole lumpkin
Courses Plus Student 5,328 Pointsnicole lumpkin
Courses Plus Student 5,328 PointsHey Sarah, I'd love to help but you're ahead of me in the materials :) I did however search the title of the challenge in the community and the second post I can across detailed an explanation as well as the solution. Perhaps you could work backwards and figure out where things went wrong. Search phrase: CRUD Search Function