Permalink
Browse files

moderator related fixes

  • Loading branch information...
1 parent fe7438c commit 6cca93dfd7df11a9b828e34ba758656aace10516 @evildmp committed Dec 20, 2012
Showing with 28 additions and 6 deletions.
  1. +6 −0 arkestra_image_plugin/models.py
  2. +3 −3 links/cms_plugins.py
  3. +19 −3 links/models.py
@@ -159,6 +159,12 @@ def number_of_items(self):
def __unicode__(self):
return u"image-set-%s" % self.kind
+ def copy_relations(self, oldinstance):
+ for plugin_item in oldinstance.imageset_item.all():
+ plugin_item.pk = None
+ plugin_item.plugin = self
+ plugin_item.save()
+
class ImageSetItem(models.Model, LinkMethodsMixin):
class Meta:
ordering=('id',)
@@ -42,7 +42,7 @@ def icon_src(self, instance):
return "/static/plugin_icons/focus_on.png"
def render(self, context, instance, placeholder):
- focuson = instance.focuson_items.order_by('?')[0]
+ focuson = instance.focuson_item.order_by('?')[0]
focuson.heading_level = instance.heading_level
context.update({
'focuson':focuson,
@@ -97,7 +97,7 @@ def icon_src(self, instance):
return "/static/plugin_icons/links.png"
def render(self, context, instance, placeholder):
- all_links = instance.links.all()
+ all_links = instance.links_item.all()
links = [link for link in all_links if link.destination_content_object]
# are there at least two items? if so, the second-last has a final_separator
if len(links) > 1:
@@ -154,7 +154,7 @@ def icon_src(self, instance):
def render(self, context, instance, placeholder):
segments = list(instance.carousel_item.all())
if len(segments) < 2:
- return # because it would be silly to have a carousel with only one segment
+ return context # because it would be silly to have a carousel with only one segment
# widths a fraction of nominal container width (deprecated)
placeholder_width = get_placeholder_width(context, instance)
View
@@ -257,9 +257,15 @@ class GenericLinkListPlugin(CMSPlugin):
separator = models.CharField(help_text = "Applies to Inline links only; default is ', '", max_length=20, null = True, blank = True, default = ", ")
final_separator = models.CharField(help_text = "Applies to Inline links only; default is ' and '", max_length=20, null = True, blank = True, default = " and ")
+ def copy_relations(self, oldinstance):
+ for plugin_item in oldinstance.links_item.all():
+ plugin_item.pk = None
+ plugin_item.plugin = self
+ plugin_item.save()
+
class GenericLinkListPluginItem(Link):
- plugin = models.ForeignKey(GenericLinkListPlugin, related_name="links")
+ plugin = models.ForeignKey(GenericLinkListPlugin, related_name="links_item")
key_link = models.BooleanField(help_text="Make this item stand out (for links in lists only)")
class Meta:
@@ -306,7 +312,11 @@ class CarouselPlugin(CMSPlugin):
aspect_ratio = models.FloatField(null=True, blank=True,
choices=ASPECT_RATIOS, default=1.5)
#height = models.PositiveIntegerField(null=True, blank=True)
-
+ def copy_relations(self, oldinstance):
+ for plugin_item in oldinstance.carousel_item.all():
+ plugin_item.pk = None
+ plugin_item.plugin = self
+ plugin_item.save()
class CarouselPluginItem(BaseLink, LinkMethodsMixin):
"""
@@ -320,9 +330,15 @@ class CarouselPluginItem(BaseLink, LinkMethodsMixin):
class FocusOnPluginEditor(CMSPlugin):
heading_level = models.PositiveSmallIntegerField(choices = PLUGIN_HEADING_LEVELS, default = PLUGIN_HEADING_LEVEL_DEFAULT)
+ def copy_relations(self, oldinstance):
+ for plugin_item in oldinstance.focuson_item.all():
+ plugin_item.pk = None
+ plugin_item.plugin = self
+ plugin_item.save()
+
class FocusOnPluginItemEditor(LinkMethodsMixin, BaseLink):
- plugin = models.ForeignKey(FocusOnPluginEditor, related_name="focuson_items")
+ plugin = models.ForeignKey(FocusOnPluginEditor, related_name="focuson_item")
text_override = models.CharField(max_length=256, null=True, blank=True,
help_text="Override the default link text")
short_text_override = models.CharField(max_length=256, null=True, blank=True,

0 comments on commit 6cca93d

Please sign in to comment.