From 39f9b9b0c21014e864672ecbc18572fe9e35ec69 Mon Sep 17 00:00:00 2001 From: Karl Hobley Date: Thu, 26 Jun 2014 09:34:42 +0100 Subject: [PATCH] Renamed 'duplicate' to 'copy' --- wagtail/wagtailcore/models.py | 6 +++--- wagtail/wagtailcore/tests/test_page_model.py | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/wagtail/wagtailcore/models.py b/wagtail/wagtailcore/models.py index 42307382d..7945fa53a 100644 --- a/wagtail/wagtailcore/models.py +++ b/wagtail/wagtailcore/models.py @@ -556,7 +556,7 @@ class Page(MP_Node, ClusterableModel, Indexed): new_self.save() new_self._update_descendant_url_paths(old_url_path, new_url_path) - def duplicate(self, recursive=False, **update_fields): + def copy(self, recursive=False, **update_fields): page_copy = Page.objects.get(id=self.id).specific page_copy.pk = None page_copy.id = None @@ -566,12 +566,12 @@ class Page(MP_Node, ClusterableModel, Indexed): page_copy = self.add_sibling(instance=page_copy) - # Duplicate child objects + # Copy child objects if hasattr(self._meta, 'child_relations'): for child_relation in self._meta.child_relations: pass - # Duplicate child pages + # Copy child pages if recursive: pass diff --git a/wagtail/wagtailcore/tests/test_page_model.py b/wagtail/wagtailcore/tests/test_page_model.py index 403475ebb..86df5bf7c 100644 --- a/wagtail/wagtailcore/tests/test_page_model.py +++ b/wagtail/wagtailcore/tests/test_page_model.py @@ -226,14 +226,14 @@ class TestMovePage(TestCase): self.assertEqual(christmas.url_path, '/home/about-us/events/christmas/') -class TestDuplicatePage(TestCase): +class TestCopyPage(TestCase): fixtures = ['test.json'] - def test_duplicate_page_copies(self): + def test_copy_page_copies(self): about_us = SimplePage.objects.get(url_path='/home/about-us/') - # Duplicate it - new_about_us = about_us.duplicate(title="New about us", slug='new-about-us') + # Copy it + new_about_us = about_us.copy(title="New about us", slug='new-about-us') # Check that new_about_us is correct self.assertIsInstance(new_about_us, SimplePage) @@ -243,11 +243,11 @@ class TestDuplicatePage(TestCase): # Check that new_about_us is a different page self.assertNotEqual(about_us.id, new_about_us.id) - def test_duplicate_page_copies_child_objects(self): + def test_copy_page_copies_child_objects(self): christmas_event = EventPage.objects.get(url_path='/home/events/christmas/') - # Duplicate it - new_christmas_event = christmas_event.duplicate(title="New christmas event", slug='new-christmas-event') + # Copy it + new_christmas_event = christmas_event.copy(title="New christmas event", slug='new-christmas-event') # Check that the speakers were copied self.assertEqual(new_christmas_event.speakers.count(), 1, "Child objects weren't copied") @@ -255,11 +255,11 @@ class TestDuplicatePage(TestCase): # Check that the speakers weren't removed from old page self.assertEqual(christmas_event.speakers.count(), 1, "Child objects were removed from the original page") - def test_duplicate_page_copies_recursively(self): + def test_copy_page_copies_recursively(self): events_index = EventIndex.objects.get(url_path='/home/events/') - # Duplicate it - new_events_index = events_index.duplicate(recursive=True, title="New events index", slug='new-events-index') + # Copy it + new_events_index = events_index.copy(recursive=True, title="New events index", slug='new-events-index') # Get christmas event old_christmas_event = events_index.get_children().filter(slug='christmas').first()