def test_nodetypes_published(self): self.assertEquals( nodetypes_published(Nodetype.objects.all()).count(), 1) self.nodetype_2.status = PUBLISHED self.nodetype_2.save() self.assertEquals( nodetypes_published(Nodetype.objects.all()).count(), 2) self.nodetype_1.sites.clear() self.assertEquals( nodetypes_published(Nodetype.objects.all()).count(), 1) self.nodetype_1.sites.add(*self.sites) self.nodetype_1.start_publication = datetime(2020, 1, 1) self.nodetype_1.save() self.assertEquals( nodetypes_published(Nodetype.objects.all()).count(), 1) self.nodetype_1.start_publication = datetime(2000, 1, 1) self.nodetype_1.save() self.assertEquals( nodetypes_published(Nodetype.objects.all()).count(), 2) self.nodetype_1.end_publication = datetime(2000, 1, 1) self.nodetype_1.save() self.assertEquals( nodetypes_published(Nodetype.objects.all()).count(), 1) self.nodetype_1.end_publication = datetime(2020, 1, 1) self.nodetype_1.save() self.assertEquals( nodetypes_published(Nodetype.objects.all()).count(), 2)
def test_nodetypes_published(self): self.assertEquals(nodetypes_published(Nodetype.objects.all()).count(), 1) self.nodetype_2.status = PUBLISHED self.nodetype_2.save() self.assertEquals(nodetypes_published(Nodetype.objects.all()).count(), 2) self.nodetype_1.sites.clear() self.assertEquals(nodetypes_published(Nodetype.objects.all()).count(), 1) self.nodetype_1.sites.add(*self.sites) self.nodetype_1.start_publication = datetime(2020, 1, 1) self.nodetype_1.save() self.assertEquals(nodetypes_published(Nodetype.objects.all()).count(), 1) self.nodetype_1.start_publication = datetime(2000, 1, 1) self.nodetype_1.save() self.assertEquals(nodetypes_published(Nodetype.objects.all()).count(), 2) self.nodetype_1.end_publication = datetime(2000, 1, 1) self.nodetype_1.save() self.assertEquals(nodetypes_published(Nodetype.objects.all()).count(), 1) self.nodetype_1.end_publication = datetime(2020, 1, 1) self.nodetype_1.save() self.assertEquals(nodetypes_published(Nodetype.objects.all()).count(), 2)
def items(self, obj): """Items are the published nodetypes of the author""" return nodetypes_published(obj.nodetypes)[:FEEDS_MAX_ITEMS]
def related_published(self): """Return only related nodetypes published""" return nodetypes_published(self.related)
def nodetypes_published(self): """ Return only the published nodetypes """ return nodetypes_published(self.nodetypes)
def nodetypes_published(self): """Return only the nodetypes published""" return nodetypes_published(self.nodetypes)