Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #62 from evildmp/moderator-related-fixes

Moderator related fixes
  • Loading branch information...
commit aed66a1e84d51a74eefc20619c2038853739206a 2 parents 54df00c + b62aa24
@evildmp authored
View
7 arkestra_image_plugin/cms_plugins.py
@@ -509,8 +509,11 @@ def get_thumbnail(self, context, instance):
return instance.image.image.thumbnails['admin_tiny_icon']
def icon_src(self, instance):
- return instance.image.thumbnails['admin_tiny_icon']
-
+ if instance.image:
+ try:
+ return instance.image.image.thumbnails['admin_tiny_icon']
+ except KeyError:
+ pass
plugin_pool.register_plugin(FilerImagePlugin)
View
6 arkestra_image_plugin/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',)
View
4 arkestra_utilities/admin_tabs_extension/tabs.py
@@ -13,10 +13,6 @@
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
-try:
- set11
-except NameError:
- from sets import Set as set # Python 2.3 fallback
"""
View
6 links/cms_plugins.py
@@ -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
22 links/models.py
@@ -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,
Please sign in to comment.
Something went wrong with that request. Please try again.