How to use the publish.models.FlatPage.objects function in publish

To help you get started, we’ve selected a few publish examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github johnsensible / django-publish / publish / tests.py View on Github external
def test_all(self): 
            self.failUnlessEqual([self.flat_page1, self.flat_page2], list(FlatPage.objects.all()))
            
            # publishing will produce extra copies
            self.flat_page1.publish()
            self.failUnlessEqual(3, FlatPage.objects.count())
            
            self.flat_page2.publish()
            self.failUnlessEqual(4, FlatPage.objects.count())
github johnsensible / django-publish / publish / tests.py View on Github external
def test_delete_after_publish(self):
            self.flat_page.save()
            self.flat_page.publish()
            public = self.flat_page.public
            self.failUnless(public)
            
            self.flat_page.delete()
            self.failUnlessEqual(Publishable.PUBLISH_DELETE, self.flat_page.publish_state)

            self.failUnlessEqual(set([self.flat_page, self.flat_page.public]), set(FlatPage.objects.all()))
github johnsensible / django-publish / publish / tests.py View on Github external
def test_deleted(self):
            self.failUnlessEqual([], list(FlatPage.objects.deleted()))
            
            self.flat_page1.publish()
            self.failUnlessEqual([], list(FlatPage.objects.deleted()))

            self.flat_page1.delete()
            self.failUnlessEqual([self.flat_page1], list(FlatPage.objects.deleted()))
github johnsensible / django-publish / publish / tests.py View on Github external
def test_changed(self):
            self.failUnlessEqual([self.flat_page1, self.flat_page2], list(FlatPage.objects.changed()))
            
            self.flat_page1.publish()
            self.failUnlessEqual([self.flat_page2], list(FlatPage.objects.changed()))
            
            self.flat_page2.publish()
            self.failUnlessEqual([], list(FlatPage.objects.changed()))
github johnsensible / django-publish / publish / tests.py View on Github external
def test_publish(self):
            self.failUnlessEqual([], list(FlatPage.objects.published()))
            
            FlatPage.objects.draft().publish()

            flat_page1 = FlatPage.objects.get(id=self.flat_page1.id)
            flat_page2 = FlatPage.objects.get(id=self.flat_page2.id)
 
            self.failUnlessEqual(set([flat_page1.public, flat_page2.public]), set(FlatPage.objects.published()))
github johnsensible / django-publish / publish / tests.py View on Github external
def test_unpublish(self):
            self.flat_page.save()
            published_page = self.flat_page.publish()

            _draft_page = FlatPage.objects.get(pk=self.flat_page.pk)
            _published_page = FlatPage.objects.get(pk=published_page.pk)

            self.failUnlessEqual(_draft_page.public.pk, _published_page.pk)

            _draft_page.unpublish()

            _published_page = FlatPage.objects.filter(pk=published_page.pk)
            self.failUnlessEqual(0, len(_published_page))
            self.failUnlessEqual(None, _draft_page.public)
            self.failUnlessEqual(Publishable.PUBLISH_CHANGED, _draft_page.publish_state)
github johnsensible / django-publish / publish / tests.py View on Github external
def test_delete(self):
            # delete is overriden, so it marks the public instances
            self.flat_page1.publish()
            public1 = self.flat_page1.public
            
            FlatPage.objects.draft().delete()
            
            self.failUnlessEqual([], list(FlatPage.objects.draft()))
            self.failUnlessEqual([self.flat_page1], list(FlatPage.objects.deleted()))
            self.failUnlessEqual([public1], list(FlatPage.objects.published()))
            self.failUnlessEqual([self.flat_page1], list(FlatPage.objects.draft_and_deleted()))
github johnsensible / django-publish / publish / tests.py View on Github external
def test_delete(self):
            # delete is overriden, so it marks the public instances
            self.flat_page1.publish()
            public1 = self.flat_page1.public
            
            FlatPage.objects.draft().delete()
            
            self.failUnlessEqual([], list(FlatPage.objects.draft()))
            self.failUnlessEqual([self.flat_page1], list(FlatPage.objects.deleted()))
            self.failUnlessEqual([public1], list(FlatPage.objects.published()))
            self.failUnlessEqual([self.flat_page1], list(FlatPage.objects.draft_and_deleted()))
github johnsensible / django-publish / publish / tests.py View on Github external
def test_publish_deletions(self):
            self.flat_page.save()
            self.flat_page.publish()
            public = self.flat_page.public
            
            self.failUnlessEqual(set([self.flat_page, public]), set(FlatPage.objects.all()))
 
            self.flat_page.delete()
            self.failUnlessEqual(set([self.flat_page, public]), set(FlatPage.objects.all()))
                       
            self.flat_page.publish()
            self.failUnlessEqual([], list(FlatPage.objects.all()))