Nov

26

Your Ever-bloggin' Man

I changed something else on the site just now, but you can't see it. I changed the home page view to wrap the date-based archive_index view instead of just direct_to_template.

So now, when I write my 16th news post, the first post will slide out of view on the home page. And if I get sneaky and write any posts dated into the future, they'll stay tucked away until the appointed date and time.

Here's how my home view looks now:

def home(request):
return date_based.archive_index(
request,
BlogPost.objects.all(),
date_field='pub_date',
template_name='blog/home.html',
template_object_name='latest_blogposts')

And clever (for once) me, I remembered to run my tests and discovered that two no longer worked because I'd changed the name of the list of blog posts. That's fixed and all tests are passing. I haven't added any tests to confirm that archive_index is doing its special thing, though. That's bad. I should add a couple tests tomorrow. It's too late to be TDD, but it would be something.