torchbox/wagtail — pull request #838 by timorieber (2014-11-30 22:19:37+00:00)
Title: Implemented parent page change when copying (enhancement, issue-390)

Hi wagtail developers,

always keeping my eyes open to spot great web development frameworks, tools and application services I'm playing around with django since nearly two years on a private basis developing a small business website for my wife. Some months ago I was looking for a django cms to put my (small) pieces together in one place. Since then I'm using wagtail and really much appreciate your work and hopefully wanted to give something back to the open source community the first time.

When copying a page it is now possible to decide to which destination/parent page the copy will be assigned.

![image](https://cloud.githubusercontent.com/assets/1807610/5239583/05bc08ae-78e7-11e4-9bc5-afab1e3bb64f.png)

Instead of leaving the PageChooser empty if the new page should go to the same parent page as before (as mentioned in the issue description), it is now prefilled with this original parent page. I think this is more explicit to the user and additionally eases the handling in the corresponding view when posting (no extra need to check for empty as this is done by the form validation). After receiving an invalid form this mechanism lets us also prefill the field with the user's choice.

At this point I experienced some problems with the ModelChoiceField in combination with a PageChooser. After invalid form submissions I needed kind of a little workaround to prefill the PageChooser with the users choice. Maybe there are some suggestions?

Slug-checking is implemented on a per-parent-page-basis, this means that a unchanged slug is still invalid on the original parent page, but hopefully (from the users point of view) will be valid within the context of another parent page.

![image](https://cloud.githubusercontent.com/assets/1807610/5239589/357d5188-78e7-11e4-8980-86d6a759bfc6.png)

Looking forward to hear from you or even get this pull request accepted!
Best regards,
Timo