Exemple #1
0
 def test_objecttypes_published(self):
     self.assertEquals(objecttypes_published(Objecttype.objects.all()).count(), 1)
     self.objecttype_2.status = PUBLISHED
     self.objecttype_2.save()
     self.assertEquals(objecttypes_published(Objecttype.objects.all()).count(), 2)
     self.objecttype_1.sites.clear()
     self.assertEquals(objecttypes_published(Objecttype.objects.all()).count(), 1)
     self.objecttype_1.sites.add(*self.sites)
     self.objecttype_1.start_publication = datetime(2020, 1, 1)
     self.objecttype_1.save()
     self.assertEquals(objecttypes_published(Objecttype.objects.all()).count(), 1)
     self.objecttype_1.start_publication = datetime(2000, 1, 1)
     self.objecttype_1.save()
     self.assertEquals(objecttypes_published(Objecttype.objects.all()).count(), 2)
     self.objecttype_1.end_publication = datetime(2000, 1, 1)
     self.objecttype_1.save()
     self.assertEquals(objecttypes_published(Objecttype.objects.all()).count(), 1)
     self.objecttype_1.end_publication = datetime(2020, 1, 1)
     self.objecttype_1.save()
     self.assertEquals(objecttypes_published(Objecttype.objects.all()).count(), 2)
Exemple #2
0
 def objecttypes_published(self):
     """Return only the objecttypes published"""
     return objecttypes_published(self.objecttypes)
Exemple #3
0
 def related_published(self):
     """Return only related objecttypes published"""
     return objecttypes_published(self.related)
Exemple #4
0
 def items(self, obj):
     """Items are the published objecttypes of the author"""
     return objecttypes_published(obj.objecttypes)[:FEEDS_MAX_ITEMS]