From cd168a2b410f60698e8a7f4a2c0fe9187506cc43 Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Thu, 29 Oct 2015 12:10:46 +0000 Subject: [PATCH] Skip M2M relations in the field list when copying pages - fixes #1852 --- wagtail/wagtailcore/models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wagtail/wagtailcore/models.py b/wagtail/wagtailcore/models.py index ccdafbcab7..d17517a482 100644 --- a/wagtail/wagtailcore/models.py +++ b/wagtail/wagtailcore/models.py @@ -739,6 +739,11 @@ class Page(six.with_metaclass(PageBase, MP_Node, ClusterableModel, index.Indexed if field.auto_created: continue + # Ignore m2m relations - they will be copied as child objects + # if modelcluster supports them at all (as it does for tags) + if field.many_to_many: + continue + # Ignore parent links (page_ptr) if isinstance(field, models.OneToOneField) and field.parent_link: continue