Commits

Anonymous committed bf4f05f

Added TYPE_CHOICES. Can for example be used to set column-count css

Comments (0)

Files changed (2)

markupmirror/feincms/models.py

         verbose_name = _(u"Markup content")
         verbose_name_plural = _(u"Markup content")
 
+    @classmethod
+    def initialize_type(cls, TYPE_CHOICES=None):
+        if TYPE_CHOICES is None:
+            raise ImproperlyConfigured('You have to set TYPE_CHOICES when'
+                ' creating a %s' % cls.__name__)
+
+        cls.add_to_class('type', models.CharField(_('type'),
+            max_length=20, choices=TYPE_CHOICES, default=TYPE_CHOICES[0][0]))
+
     def render(self, **kwargs):
         request = kwargs.get('request')
         return render_to_string('content/markupmirror/default.html', {

markupmirror/templates/content/markupmirror/default.html

-{{ content.content.rendered|safe }}
+<span class="{{ content.type }}">{{ content.content.rendered|safe }}</span>