The User Model4:57 with Kenneth Love
Nearly every good web app needs a way to represent a user, so we need to create our `User` model. We'll hold onto just a few fields so we can get people in and using our app as easily as possible.
order_by can take one or more fields to order records by by default. Each field can also have a
- at the beginning to mark it as being sorted in descending order.
So why can't we do
order_by = ('joined_at', 'desc')? Because each member of the
order_by tuple is the name of a field, so that would be telling our model to order by the
'joined_at' field and the
'desc' field, which doesn't exist.
order_by is a tuple (you can use a list if you want), we have to include that trailing comma if there's only one tuple member.
You need to sign up for Treehouse in order to download course files.Sign up