Anonymous avatar 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>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.