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 trialMUZ140249 Sibusisiwe Dube
2,900 Pointschallenge task 4 of 4
meet peewee; am getting a bummer which says challenge not in ascending order insted it is 1,5,2,. i don' t know where i am missing it. please help. thanks
from models import Challenge
all_challenges = Challenge.select()
Challenge.create(language='Ruby', name='Booleans')
sorted_challenges = all_challenges.select().order_by()
3 Answers
Bhupend Patil
25,918 PointsYou made .select()
in 2nd step so you don't have to write it again.
Should look like this: sorted_challenges = all_challenges.order_by()
.
But then you have to specify records ordered by the steps
attribute on the model i.e from imported Challenge class
So finally ordered by should look like this: order_by(Challenge.steps)
Annie Scott
27,613 PointsTASK 1 - 4
from models import Challenge
all_challenges = Challenge.select()
Challenge.create(language='Ruby', name='Booleans')
sorted_challenges = all_challenges.order_by(Challenge.steps)
Henry Howes
4,767 PointsThis question asks that the challenges be ordered with the steps attribute of Challenge, so this must be passed as a parameter to order_by().