Permalink
Browse files

Added copy_relations methods

Try to make media_tree work with DjangoCMS 2.4
  • Loading branch information...
erlenddalen committed May 28, 2013
1 parent 9179cfd commit 4f76f3abe67a38d8fd49efd36d3547feeb23fdee
@@ -25,5 +25,8 @@ class MediaTreeImage(CMSPlugin):
objects = MediaTreeImageSiteManager()
+ def copy_relations(self, oldinstance):
+ self.node = oldinstance.node.all()
+
def __unicode__(self):
return self.node.__unicode__()
@@ -14,6 +14,12 @@ class MediaTreeListingBase(CMSPlugin):
filename_filter = models.CharField(_('filter file and folder names'), max_length=255, null=True, blank=True, help_text=_('Example: *.jpg; Documents.*;'), editable=False)
include_descendants = models.BooleanField(_('include all subfolders'), default=True)
+ def copy_relations(self, oldinstance):
+ for media_item in oldinstance.media_items.all():
+ media_item.pk = None
+ media_item.list_plugin = self
+ media_item.save()
+
class Meta:
abstract = True

0 comments on commit 4f76f3a

Please sign in to comment.