Beispiel #1
0
    def move_page(self, target, position="first-child"):
        """Called from admin interface when page is moved. Should be used on
        all the places which are changing page position. Used like an interface
        to mptt, but after move is done page_moved signal is fired.
        """
        # make sure move_page does not break when using INHERIT template
        if (
            position in ("left", "right")
            and not target.parent
            and self.template == settings.CMS_TEMPLATE_INHERITANCE_MAGIC
        ):
            self.template = self.get_template()
        self.move_to(target, position)

        # fire signal
        from cms.models.moderatormodels import PageModeratorState

        self.force_moderation_action = PageModeratorState.ACTION_MOVE
        import cms.signals as cms_signals

        cms_signals.page_moved.send(sender=Page, instance=self)  # titles get saved before moderation
        self.save(change_state=True)  # always save the page after move, because of publisher

        # check the slugs
        page_utils.check_title_slugs(self)
Beispiel #2
0
    def move_page(self, target, position='first-child'):
        """
        Called from admin interface when page is moved. Should be used on
        all the places which are changing page position. Used like an interface
        to mptt, but after move is done page_moved signal is fired.

        Note for issue #1166: url conflicts are handled by updated
        check_title_slugs, overwrite_url on the moved page don't need any check
        as it remains the same regardless of the page position in the tree
        """
        # make sure move_page does not break when using INHERIT template
        if (position in ('left', 'right') and not target.parent
                and self.template == settings.CMS_TEMPLATE_INHERITANCE_MAGIC):
            self.template = self.get_template()
        self.move_to(target, position)

        # fire signal
        from cms.models.moderatormodels import PageModeratorState
        self.force_moderation_action = PageModeratorState.ACTION_MOVE
        import cms.signals as cms_signals
        cms_signals.page_moved.send(
            sender=Page, instance=self)  # titles get saved before moderation
        self.save(change_state=True
                  )  # always save the page after move, because of publisher

        # check the slugs
        page_utils.check_title_slugs(self)
Beispiel #3
0
    def move_page(self, target, position='first-child'):
        """
        Called from admin interface when page is moved. Should be used on
        all the places which are changing page position. Used like an interface
        to mptt, but after move is done page_moved signal is fired.

        Note for issue #1166: url conflicts are handled by updated
        check_title_slugs, overwrite_url on the moved page don't need any check
        as it remains the same regardless of the page position in the tree
        """
        # make sure move_page does not break when using INHERIT template
        # and moving to a top level position
        if (position in ('left', 'right')
            and not target.parent
            and self.template == constants.TEMPLATE_INHERITANCE_MAGIC):
            self.template = self.get_template()
        self.move_to(target, position)

        # fire signal
        from cms.models.moderatormodels import PageModeratorState
        from cms.utils import moderator
        import cms.signals as cms_signals
        cms_signals.page_moved.send(sender=Page, instance=self)  # titles get saved before moderation
        self.save()  # always save the page after move, because of publisher
        moderator.page_changed(self, force_moderation_action=PageModeratorState.ACTION_MOVE)
        # check the slugs
        page_utils.check_title_slugs(self)
Beispiel #4
0
 def move_page(self, target, position='first-child'):
     """Called from admin interface when page is moved. Should be used on
     all the places which are changing page position. Used like an interface
     to mptt, but after move is done page_moved signal is fired.
     """
     self.move_to(target, position)
     
     # fire signal
     from cms.models.moderatormodels import PageModeratorState
     self.force_moderation_action = PageModeratorState.ACTION_MOVE
     cms_signals.page_moved.send(sender=Page, instance=self) #titles get saved before moderation
     self.save(change_state=True) # always save the page after move, because of publisher
     
     # check the slugs
     check_title_slugs(self)
Beispiel #5
0
 def move_page(self, target, position='first-child'):
     """Called from admin interface when page is moved. Should be used on
     all the places which are changing page position. Used like an interface
     to mptt, but after move is done page_moved signal is fired.
     """
     self.move_to(target, position)
     
     # fire signal
     from cms.models.moderatormodels import PageModeratorState
     self.force_moderation_action = PageModeratorState.ACTION_MOVE
     import cms.signals as cms_signals
     cms_signals.page_moved.send(sender=Page, instance=self) #titles get saved before moderation
     self.save(change_state=True) # always save the page after move, because of publisher
     
     # check the slugs
     check_title_slugs(self)
Beispiel #6
0
    def move_page(self, target, position='first-child'):
        """
        Called from admin interface when page is moved. Should be used on
        all the places which are changing page position. Used like an interface
        to mptt, but after move is done page_moved signal is fired.

        Note for issue #1166: url conflicts are handled by updated
        check_title_slugs, overwrite_url on the moved page don't need any check
        as it remains the same regardless of the page position in the tree
        """
        # do not mark the page as dirty after page moves
        self._publisher_keep_state = True

        # make sure move_page does not break when using INHERIT template
        # and moving to a top level position

        if (position in ('left', 'right')
        and not target.parent
        and self.template == constants.TEMPLATE_INHERITANCE_MAGIC):
            self.template = self.get_template()
        self.move_to(target, position)

        # fire signal
        import cms.signals as cms_signals

        cms_signals.page_moved.send(sender=Page, instance=self)
        self.save()  # always save the page after move, because of publisher
        # check the slugs
        page_utils.check_title_slugs(self)

        if self.publisher_public_id:
            # Ensure we have up to date mptt properties
            public_page = Page.objects.get(pk=self.publisher_public_id)
            # Ensure that the page is in the right position and save it
            public_page = self._publisher_save_public(public_page)
            cms_signals.page_moved.send(sender=Page, instance=public_page)
            public_page.save()
            page_utils.check_title_slugs(public_page)
Beispiel #7
0
    def move_page(self, target, position='first-child'):
        """
        Called from admin interface when page is moved. Should be used on
        all the places which are changing page position. Used like an interface
        to mptt, but after move is done page_moved signal is fired.

        Note for issue #1166: url conflicts are handled by updated
        check_title_slugs, overwrite_url on the moved page don't need any check
        as it remains the same regardless of the page position in the tree
        """
        # do not mark the page as dirty after page moves
        self._publisher_keep_state = True

        # make sure move_page does not break when using INHERIT template
        # and moving to a top level position

        if (position in ('left', 'right')
        and not target.parent
        and self.template == constants.TEMPLATE_INHERITANCE_MAGIC):
            self.template = self.get_template()
        self.move_to(target, position)

        # fire signal
        import cms.signals as cms_signals

        cms_signals.page_moved.send(sender=Page, instance=self)
        self.save()  # always save the page after move, because of publisher
        # check the slugs
        page_utils.check_title_slugs(self)

        if self.publisher_public_id:
            # Ensure we have up to date mptt properties
            public_page = Page.objects.get(pk=self.publisher_public_id)
            # Ensure that the page is in the right position and save it
            public_page = self._publisher_save_public(public_page)
            cms_signals.page_moved.send(sender=Page, instance=public_page)
            public_page.save()
            page_utils.check_title_slugs(public_page)