def setUp(self): self.now = datetime.datetime.utcnow().replace(tzinfo=utc) self.timedelta = datetime.timedelta(15) author = User.objects.get(pk=1) category = Category() category.name = "Test Category" for count in range(1, 11): post = Post(title="Post %d Title" % count, text="foo", author=author) if count < 6: # publish the first five posts pubdate = self.now - self.timedelta * count post.published_date = pubdate if count % 2: post.category = category post.save()