mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-12 01:03:11 +00:00
Renamed 'duplicate' to 'copy'
This commit is contained in:
parent
40ca017c36
commit
39f9b9b0c2
2 changed files with 13 additions and 13 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue