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
Hanley Chan27,771 Points
Help with quiz question regarding sorting based on published attribute.
I am having trouble with this quiz question:
In the following query, I want to change the sorting of my records. How would I sort them based on their published attribute so I get the oldest first?
I tried "Entry.select().order_by(Entry.published.desc())", but it is not correct. What is the correct answer for this one?
Keith Whatling17,752 Points
Finally after 5 tries!
Ok so the thing we are all doing wrong it being too damn complex. Leave all reference to asc() and desc(), no need for plus and minus. Grr that was really frustrating.
The PeeWee docs are missing the bit that tell you that there is a default to order_by, or the treehouse test needs a little tweak.
Hope this helps.
Anna Hull6,600 Points
I am working on this quiz right now as well - according to the PeeWee Docs this should work:
Or one of these:
Kenneth Love, maybe you can help us out with this one!
This question was also answered here on Treehouse Forums.