Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixes #2833

  • Loading branch information...
commit 1d63f483486ebc55fc225be8ce6f98524c5b4e6e 1 parent 698fe1c
@digi604 digi604 authored
Showing with 10 additions and 12 deletions.
  1. +3 −6 cms/admin/pageadmin.py
  2. +7 −6 cms/models/pagemodel.py
View
9 cms/admin/pageadmin.py
@@ -220,12 +220,8 @@ def save_model(self, request, obj, form, change):
if not copy_target.has_view_permission(request):
raise PermissionDenied()
obj = Page.objects.get(pk=obj.pk) #mptt reload
- if not 'add_page_type' in request.GET:
- site_id = obj.site_id
- copy_target._copy_attributes(obj)
- obj.site_id = site_id
- obj.reverse_id = None
- obj.save()
+ copy_target._copy_attributes(obj, clean=True)
+ obj.save()
for lang in copy_target.languages.split(','):
copy_target._copy_contents(obj, lang)
if not 'permission' in request.path:
@@ -236,6 +232,7 @@ def save_model(self, request, obj, form, change):
form,
language,
)
+ # is it home? publish it right away
if new and Page.objects.filter(site_id=obj.site_id).count() == 1:
obj.publish(language)
View
13 cms/models/pagemodel.py
@@ -257,19 +257,20 @@ def _copy_contents(self, target, language):
if plugins:
copy_plugins_to(plugins, ph)
- def _copy_attributes(self, target):
+ def _copy_attributes(self, target, clean=False):
"""
Copy all page data to the target. This excludes parent and other values
that are specific to an exact instance.
:param target: The Page to copy the attributes to
"""
- target.publication_date = self.publication_date
- target.publication_end_date = self.publication_end_date
- target.in_navigation = self.in_navigation
+ if not clean:
+ target.publication_date = self.publication_date
+ target.publication_end_date = self.publication_end_date
+ target.reverse_id = self.reverse_id
target.login_required = self.login_required
- target.limit_visibility_in_menu = self.limit_visibility_in_menu
+ target.in_navigation = self.in_navigation
target.soft_root = self.soft_root
- target.reverse_id = self.reverse_id
+ target.limit_visibility_in_menu = self.limit_visibility_in_menu
target.navigation_extenders = self.navigation_extenders
target.application_urls = self.application_urls
target.application_namespace = self.application_namespace
Please sign in to comment.
Something went wrong with that request. Please try again.