예제 #1
0
 def create_snapshot(self):
     """
     Makes a copy of itselve with all the content and returns the copy.
     """
     snapshot = copy_model_instance(self, exclude=('id',))
     snapshot.active = False
     snapshot.save()
     snapshot.copy_content_from(self)
     for attachment in self.attachments.all():
         attachment_copy = copy_model_instance(attachment, exclude=('id', 'newsletter'))
         attachment_copy.newsletter = snapshot
         attachment_copy.save()
     return snapshot
예제 #2
0
 def create_snapshot(self):
     """
     Makes a copy of itselve with all the content and returns the copy.
     """
     snapshot = copy_model_instance(self, exclude=('id', ))
     snapshot.active = False
     snapshot.save()
     snapshot.copy_content_from(self)
     for attachment in self.attachments.all():
         attachment_copy = copy_model_instance(attachment,
                                               exclude=('id', 'newsletter'))
         attachment_copy.newsletter = snapshot
         attachment_copy.save()
     return snapshot
예제 #3
0
    def handle(self, request, data):

        root_page = Page.objects.get(pk=data['page_id'])

        new_page = copy_model_instance(root_page, exclude=('id', 'parent'))

        if data.get("depth", 0):
            Page.copy_content_from(root_page)
예제 #4
0
    def handle(self, request, data):

        root_page = Page.objects.get(pk=data['page_id'])

        new_page = copy_model_instance(root_page,
                                       exclude=('id', 'parent'))

        if data.get("depth", 0):
            Page.copy_content_from(root_page)
예제 #5
0
 def create_snapshot(self):
     """
     Makes a copy of itselve with all the content and returns the copy.
     """
     snapshot = copy_model_instance(self, exclude=('id',))
     snapshot.active = False
     snapshot.save()
     snapshot.copy_content_from(self)
     return snapshot
예제 #6
0
 def create_snapshot(self):
     """
     Makes a copy of itselve with all the content and returns the copy.
     """
     snapshot = copy_model_instance(self, exclude=('id',))
     snapshot.active = False
     snapshot.save()
     snapshot.copy_content_from(self)
     return snapshot
예제 #7
0
파일: models.py 프로젝트: hgrimelid/feincms
        def copy_content_from(self, obj):
            """
            Copy all content blocks over to another CMS base object. (Must be of the
            same type, but this is not enforced. It will crash if you try to copy content
            from another CMS base type.)
            """

            for cls in self._feincms_content_types:
                for content in cls.objects.filter(parent=obj):
                    new = copy_model_instance(content, exclude=('id', 'parent'))
                    new.parent = self
                    new.save()
예제 #8
0
    def create_copy(self, page):
        """
        Creates an identical copy of a page except that the new one is
        inactive.
        """

        new = copy_model_instance(page, exclude=self.exclude_from_copy)
        new.active = False
        new.save()
        new.copy_content_from(page)

        return new
예제 #9
0
        def copy_content_from(self, obj):
            """
            Copy all content blocks over to another CMS base object. (Must be of the
            same type, but this is not enforced. It will crash if you try to copy content
            from another CMS base type.)
            """

            for cls in self._feincms_content_types:
                for content in cls.objects.filter(parent=obj):
                    new = copy_model_instance(content, exclude=('id', 'parent'))
                    new.parent = self
                    new.save()
예제 #10
0
파일: models.py 프로젝트: battyone/feincms
    def create_copy(self, page):
        """
        Creates an identical copy of a page except that the new one is
        inactive.
        """

        new = copy_model_instance(page, exclude=self.exclude_from_copy)
        new.active = False
        new.save()
        new.copy_content_from(page)

        return new
예제 #11
0
def copy_newsletters(modeladmin, request, queryset):
    for newsletter in queryset:
        duplicate = copy_model_instance(newsletter, exclude=('id', ))
        duplicate.save()
        duplicate.copy_content_from(newsletter)
예제 #12
0
def copy_newsletters(modeladmin, request, queryset):
    for newsletter in queryset:
        duplicate = copy_model_instance(newsletter, exclude=('id',))
        duplicate.save()
        duplicate.copy_content_from(newsletter)