Beispiel #1
0
 def setUp(self):
     self.now = datetime.datetime.utcnow().replace(tzinfo=utc)
     self.timedelta = datetime.timedelta(15)
     author = User.objects.get(pk=1)
     for count in range(1, 11):
         post = Post(title=f"Post {count} Title", text="foo", author=author)
         if count < 6:
             pubdate = self.now - self.timedelta * count
             post.published_date = pubdate
         post.save()
Beispiel #2
0
 def setUp(self):
     self.now = datetime.datetime.utcnow().replace(tzinfo=utc)
     self.timedelta = datetime.timedelta(15)
     author = User.objects.get(pk=1)
     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
         post.save()
Beispiel #3
0
 def setUp(self):
     self.now = datetime.datetime.utcnow().replace(tzinfo=utc)
     self.timedelta = datetime.timedelta(15)
     author = User.objects.get(pk=1)
     for count in range(1, 11):
         post = Post(title="Post %d Title" % count,
                     body="This is a test",
                     author=author)
         if count < 6:
             pubdate = self.now - self.timedelta * count
             post.published_date = pubdate
         post.save()
Beispiel #4
0
    def setUp(self):
        self.now = datetime.datetime.utcnow().replace(tzinfo=utc)
        self.timedelta = datetime.timedelta(15)
        # print('now is', self.now)
        # print('time delta is', self.timedelta)
        author = User.objects.get(pk=1)
        for count in range(1, 11):
            post = Post(title="Post %d Title" % count,
                        text="foo",
                        author=author)

            if count < 6:
                # publish the first 5  posts
                pubdate = self.now - self.timedelta * count
                post.published_date = pubdate
            post.save()