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 trialMarta P.
2,849 PointsError message when booting app
When I try to boot the app, I get an error message ' KeyError= '' '. Not sure how to interpret it! Snapshot: http://w.trhou.se/byeg3920jc
Thanks:))
1 Answer
Ryan S
27,276 PointsHi Marta,
This error was a bit tricky to figure out, but it can be traced back to your order_by
Meta attribute in your Post model.
order_by
must be a tuple, and it looks like you simply forgot to add the comma to make it a tuple.
class Post(Model):
timestamp = DateTimeField(default=datetime.datetime.now)
user = ForeignKeyField(
rel_model=User,
related_name='posts'
)
content = TextField()
class Meta:
database = DATABASE
order_by = ('-timestamp',) # Add comma
Marta P.
2,849 PointsMarta P.
2,849 PointsRyan S that was it! Thank you:) Good eye!