How to use publish - 10 common examples

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_save_marks_changed(self):
            self.failUnlessEqual(Publishable.PUBLISH_DEFAULT, self.flat_page.publish_state)
            self.flat_page.save(mark_changed=False)
            self.failUnlessEqual(Publishable.PUBLISH_DEFAULT, self.flat_page.publish_state)
            self.flat_page.save()
            self.failUnlessEqual(Publishable.PUBLISH_CHANGED, self.flat_page.publish_state)
github johnsensible / django-publish / publish / tests.py View on Github external
def setUp(self):
            super(TestUnpublishSelectedAction, self).setUp()

            self.fp1 = Page.objects.create(slug='fp1', title='FP1')
            self.fp2 = Page.objects.create(slug='fp2', title='FP2')
            self.fp3 = Page.objects.create(slug='fp3', title='FP3')

            self.fp1.save()
            self.fp2.save()
            self.fp3.save()

            for page in Page.objects.draft():
                page.publish()

            self.admin_site = AdminSite('Test Admin')
            self.page_admin = PublishableAdmin(Page, self.admin_site)

            # override urls, so reverse works
            settings.ROOT_URLCONF=patterns('',
                ('^admin/', include(self.admin_site.urls)),
            )
github johnsensible / django-publish / publish / tests.py View on Github external
def setUp(self):
            self.page1  = Page.objects.create(slug='page1', title='page 1')
            self.page2  = Page.objects.create(slug='page2', title='page 2')
            self.child1 = Page.objects.create(parent=self.page1, slug='child1', title='Child 1')
            self.child2 = Page.objects.create(parent=self.page1, slug='child2', title='Child 2')
            self.child3 = Page.objects.create(parent=self.page2, slug='child3', title='Child 3')

            self.failUnlessEqual(5, Page.objects.draft().count())
github johnsensible / django-publish / publish / tests.py View on Github external
def test_get_publish_status_display(self):
            page = Page.objects.create(slug="hhkkk", title="hjkhjkh")
            self.failUnlessEqual('Changed - not yet published', self.page_admin.get_publish_status_display(page))
            page.publish()
            self.failUnlessEqual('Published', self.page_admin.get_publish_status_display(page))
            page.save()
            self.failUnlessEqual('Changed', self.page_admin.get_publish_status_display(page))
            
            page.delete()
            self.failUnlessEqual('To be deleted', self.page_admin.get_publish_status_display(page))
github johnsensible / django-publish / publish / tests.py View on Github external
def setUp(self):
            super(TestPublishableRecursiveManyToManyField, self).setUp()
            self.page = Page.objects.create(slug='page1', title='page 1', content='some content')
            self.author1 = Author.objects.create(name='author1', profile='a profile')
            self.author2 = Author.objects.create(name='author2', profile='something else')
github johnsensible / django-publish / publish / tests.py View on Github external
def setUp(self):
            super(TestPublishFunction, self).setUp()
            self.page = Page.objects.create(slug='page', title='Page')
github johnsensible / django-publish / publish / tests.py View on Github external
def setUp(self):
            self.page1  = Page.objects.create(slug='page1', title='page 1')
            self.page2  = Page.objects.create(slug='page2', title='page 2')
            self.child1 = Page.objects.create(parent=self.page1, slug='child1', title='Child 1')
            self.child2 = Page.objects.create(parent=self.page1, slug='child2', title='Child 2')
            self.child3 = Page.objects.create(parent=self.page2, slug='child3', title='Child 3')

            self.failUnlessEqual(5, Page.objects.draft().count())
github johnsensible / django-publish / publish / tests.py View on Github external
def setUp(self):
            super(TestPublishSelectedAction, self).setUp()
            self.fp1 = Page.objects.create(slug='fp1', title='FP1')
            self.fp2 = Page.objects.create(slug='fp2', title='FP2')
            self.fp3 = Page.objects.create(slug='fp3', title='FP3')

            self.admin_site = AdminSite('Test Admin')
            self.page_admin = PublishableAdmin(Page, self.admin_site)
            
            # override urls, so reverse works
            settings.ROOT_URLCONF=patterns('',
                ('^admin/', include(self.admin_site.urls)),
            )
github johnsensible / django-publish / publish / tests.py View on Github external
def setUp(self):
            self.page1 = Page.objects.create(slug='page1', title='page 1')
            self.page2 = Page.objects.create(slug='page2', title='page 2')
            self.child1 = Page.objects.create(parent=self.page1, slug='child1', title='Child 1')
            self.child2 = Page.objects.create(parent=self.page1, slug='child2', title='Child 2')
            self.child3 = Page.objects.create(parent=self.page2, slug='child3', title='Child 3')
github johnsensible / django-publish / publish / tests.py View on Github external
def setUp(self):
            self.page1 = Page.objects.create(slug='page1', title='page 1')
            self.page2 = Page.objects.create(slug='page2', title='page 2')
            self.child1 = Page.objects.create(parent=self.page1, slug='child1', title='Child 1')
            self.child2 = Page.objects.create(parent=self.page1, slug='child2', title='Child 2')
            self.child3 = Page.objects.create(parent=self.page2, slug='child3', title='Child 3')