diff --git a/CHANGES b/CHANGES
index 2a52950..4790ae8 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+- Added SimpleImagePlugin and SimpleDownloadPlugin.
+
0.3.19 2019-04-02
- Again better template_name handling.
- Added ObjectPluginBase class.
diff --git a/content_plugins/base.py b/content_plugins/base.py
index f8ba81e..db8eadb 100644
--- a/content_plugins/base.py
+++ b/content_plugins/base.py
@@ -243,35 +243,38 @@ class ObjectPluginBase(FilesystemTemplateRendererPlugin):
return inline
-# ImageBase can't live here because image managment is different from project to project
-# class ImageBase(StyleMixin, BasePlugin):
-# image = models.ForeignKey(Image, on_delete=models.PROTECT)
-# alt_caption = TranslatableCharField(_("caption"), max_length=500, null=True, blank=True, help_text=_("Optional, used instead of the caption of the image object."))#
-
-# class Meta:
-# abstract = True
-# verbose_name = _("image")
-# verbose_name_plural = _("images")#
-
-# def render(self):
-# template = """
-#
-#
#
-
-#
-# {caption_text}
-#
-#
-# """
-# # TOOD Assemble caption from image's captions if empty
-# return mark_safe(template.format(
-# src=self.image.figure_image.url,
-# caption_text=mark_safe(self.alt_caption or "")
-# ))
-
-
-# TODO See comments on ImageBase; remove DownloadBase
-class DownloadBase(StyleMixin, StringRendererPlugin):
+class SimpleImageBase(StringRendererPlugin):
+ image = models.ImageField(_("image"), upload_to='images/%Y/%m/')
+ caption = TranslatableCharField(_("caption"), max_length=500,
+ null=True, blank=True,
+ help_text=_("Optional, used instead of the caption of the image object."))
+
+ class Meta:
+ abstract = True
+ verbose_name = _("image")
+ verbose_name_plural = _("images")
+
+ def __str__(self):
+ return getattr(self.image, 'name', "")
+
+ def render(self):
+ template = """
+
+
+
+
+ {caption_text}
+
+
+ """
+
+ return mark_safe(template.format(
+ src=self.image.url,
+ caption_text=mark_safe(self.caption or "")
+ ))
+
+
+class SimpleDownloadBase(StringRendererPlugin):
file = models.FileField(upload_to='downloads/%Y/%m/')
class Meta:
@@ -284,7 +287,7 @@ class DownloadBase(StyleMixin, StringRendererPlugin):
def render(self):
template = """
- {name}
+ {name}
"""
return mark_safe(template.format(
url=self.file.url,