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 trial

Python Using Databases in Python Gettin' CRUD-y With It CRUD: Search Function

Jason Smith
Jason Smith
8,668 Points

What's the detail i'm missing? I'm not getting any syntax errors more informational than 'Try again!'

I'm not entirely sure how to match and filter the search results in this challenge. could you give me a hint?

crud.py
from models import Challenge


def create_challenge(name, language, steps=1):
    Challenge.create(name=name,
                     language=language,
                     steps=steps)

def search_challenges(name, language):
    for challenges in Challenge:
        return challenges.where(challenges.content.contains(name, language))

1 Answer

Josh Keenan
Josh Keenan
20,315 Points

You have forgotten to select anything.

return Challenge.select().where(Challenge.name.contains(name), Challenge.language == language)
Jason Smith
Jason Smith
8,668 Points

oops, lol, one moment...Thanks, that worked. Thanks for the help!