Пример #1
0
 def test_gbobjects_published(self):
     self.assertEquals(
         gbobjects_published(Gbobject.objects.all()).count(), 1)
     self.gbobject_2.status = PUBLISHED
     self.gbobject_2.save()
     self.assertEquals(
         gbobjects_published(Gbobject.objects.all()).count(), 2)
     self.gbobject_1.sites.clear()
     self.assertEquals(
         gbobjects_published(Gbobject.objects.all()).count(), 1)
     self.gbobject_1.sites.add(*self.sites)
     self.gbobject_1.start_publication = datetime(2020, 1, 1)
     self.gbobject_1.save()
     self.assertEquals(
         gbobjects_published(Gbobject.objects.all()).count(), 1)
     self.gbobject_1.start_publication = datetime(2000, 1, 1)
     self.gbobject_1.save()
     self.assertEquals(
         gbobjects_published(Gbobject.objects.all()).count(), 2)
     self.gbobject_1.end_publication = datetime(2000, 1, 1)
     self.gbobject_1.save()
     self.assertEquals(
         gbobjects_published(Gbobject.objects.all()).count(), 1)
     self.gbobject_1.end_publication = datetime(2020, 1, 1)
     self.gbobject_1.save()
     self.assertEquals(
         gbobjects_published(Gbobject.objects.all()).count(), 2)
Пример #2
0
 def test_gbobjects_published(self):
     self.assertEquals(gbobjects_published(Gbobject.objects.all()).count(), 1)
     self.gbobject_2.status = PUBLISHED
     self.gbobject_2.save()
     self.assertEquals(gbobjects_published(Gbobject.objects.all()).count(), 2)
     self.gbobject_1.sites.clear()
     self.assertEquals(gbobjects_published(Gbobject.objects.all()).count(), 1)
     self.gbobject_1.sites.add(*self.sites)
     self.gbobject_1.start_publication = datetime(2020, 1, 1)
     self.gbobject_1.save()
     self.assertEquals(gbobjects_published(Gbobject.objects.all()).count(), 1)
     self.gbobject_1.start_publication = datetime(2000, 1, 1)
     self.gbobject_1.save()
     self.assertEquals(gbobjects_published(Gbobject.objects.all()).count(), 2)
     self.gbobject_1.end_publication = datetime(2000, 1, 1)
     self.gbobject_1.save()
     self.assertEquals(gbobjects_published(Gbobject.objects.all()).count(), 1)
     self.gbobject_1.end_publication = datetime(2020, 1, 1)
     self.gbobject_1.save()
     self.assertEquals(gbobjects_published(Gbobject.objects.all()).count(), 2)
Пример #3
0
 def gbobjects_published(self):
     """Return only the gbobjects published"""
     return gbobjects_published(self.gbobjects)
Пример #4
0
 def related_published(self):
     """Return only related gbobjects published"""
     return gbobjects_published(self.related)
Пример #5
0
 def related_published(self):
     """Return only related gbobjects published"""
     return gbobjects_published(self.related)
Пример #6
0
 def items(self, obj):
     """Items are the published gbobjects of the author"""
     return gbobjects_published(obj.gbobjects)[:FEEDS_MAX_ITEMS]
Пример #7
0
 def gbobjects_published(self):
     """Return only the gbobjects published"""
     return gbobjects_published(self.gbobjects)