From 9ba91c7e8732a540637eebddcf2e75223ffe4c50 Mon Sep 17 00:00:00 2001 From: Karl Hobley Date: Tue, 22 Apr 2014 10:09:35 +0100 Subject: [PATCH] Use Treebeard 2.0 add_child method --- wagtail/wagtailadmin/tests.py | 16 ++++++++-------- wagtail/wagtailadmin/views/pages.py | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/wagtail/wagtailadmin/tests.py b/wagtail/wagtailadmin/tests.py index 84b00b3355..28b5398ee5 100644 --- a/wagtail/wagtailadmin/tests.py +++ b/wagtail/wagtailadmin/tests.py @@ -25,7 +25,7 @@ class TestPageExplorer(TestCase): self.child_page = SimplePage() self.child_page.title = "Hello world!" self.child_page.slug = "hello-world" - self.root_page.add_child(self.child_page) + self.root_page.add_child(instance=self.child_page) # Login login(self.client) @@ -125,7 +125,7 @@ class TestPageCreation(TestCase): self.child_page = SimplePage() self.child_page.title = "Hello world!" self.child_page.slug = "hello-world" - self.root_page.add_child(self.child_page) + self.root_page.add_child(instance=self.child_page) # Attempt to create a new one with the same slug post_data = { @@ -159,14 +159,14 @@ class TestPageEdit(TestCase): self.child_page.title = "Hello world!" self.child_page.slug = "hello-world" self.child_page.live = True - self.root_page.add_child(self.child_page) + self.root_page.add_child(instance=self.child_page) self.child_page.save_revision() # Add event page (to test edit handlers) self.event_page = EventPage() self.event_page.title = "Event page" self.event_page.slug = "event-page" - self.root_page.add_child(self.event_page) + self.root_page.add_child(instance=self.event_page) # Login login(self.client) @@ -222,7 +222,7 @@ class TestPageDelete(TestCase): self.child_page = SimplePage() self.child_page.title = "Hello world!" self.child_page.slug = "hello-world" - self.root_page.add_child(self.child_page) + self.root_page.add_child(instance=self.child_page) # Login login(self.client) @@ -281,18 +281,18 @@ class TestPageMove(TestCase): self.section_a = SimplePage() self.section_a.title = "Section A" self.section_a.slug = "section-a" - self.root_page.add_child(self.section_a) + self.root_page.add_child(instance=self.section_a) self.section_b = SimplePage() self.section_b.title = "Section B" self.section_b.slug = "section-b" - self.root_page.add_child(self.section_b) + self.root_page.add_child(instance=self.section_b) # Add test page into section A self.test_page = SimplePage() self.test_page.title = "Hello world!" self.test_page.slug = "hello-world" - self.section_a.add_child(self.test_page) + self.section_a.add_child(instance=self.test_page) # Login login(self.client) diff --git a/wagtail/wagtailadmin/views/pages.py b/wagtail/wagtailadmin/views/pages.py index 3fb9057151..c5df759dfb 100644 --- a/wagtail/wagtailadmin/views/pages.py +++ b/wagtail/wagtailadmin/views/pages.py @@ -181,7 +181,7 @@ def create(request, content_type_app_name, content_type_model_name, parent_page_ page.live = False page.has_unpublished_changes = True - parent_page.add_child(page) # assign tree parameters - will cause page to be saved + parent_page.add_child(instance=page) # assign tree parameters - will cause page to be saved page.save_revision(user=request.user, submitted_for_moderation=is_submitting) if is_publishing: