Publish a second test blog post, with the same Publication date as the first post.
View the blog post index (/blog)
Expected behavior
The second blog post, which was published after the first, should appear above the first blog post in the list of blog posts, since blogs typically display posts sorted from first to last posted.
Observed Behavior
The first blog post appears above the second blog post.
Additional Notes
This happens because we only store and sort by BlogPost date, which is a DateField, not a DateTimeField. There are at least two ways to fix this:
Change the BlogPost.date DateField to a BlogPost.published DateTimeField. This might make entering the publication date a little more annoying in the admin, I'm not sure if the admin widget has ergonomic defaults.
Additionally sort by another factor in addition to BlogPost.date, e.g. leverage the auto-incrementing primary key.
Steps to Reproduce
/blog
)Expected behavior
The second blog post, which was published after the first, should appear above the first blog post in the list of blog posts, since blogs typically display posts sorted from first to last posted.
Observed Behavior
The first blog post appears above the second blog post.
Additional Notes
This happens because we only store and sort by BlogPost
date
, which is aDateField
, not aDateTimeField
. There are at least two ways to fix this:BlogPost.date
DateField to aBlogPost.published
DateTimeField. This might make entering the publication date a little more annoying in the admin, I'm not sure if the admin widget has ergonomic defaults.BlogPost.date
, e.g. leverage the auto-incrementing primary key.