1. Fabian Büchler
  2. django-markupmirror


django-markupmirror / markupmirror / feincms / models.py

from __future__ import absolute_import, unicode_literals

from django.db import models
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _

from markupmirror import settings
from markupmirror.fields import MarkupMirrorField

__all__ = ('MarkupMirrorContent',)

class MarkupMirrorContent(models.Model):
    """FeinCMS Page contenttype that stores markup in a MarkupMirrorField.

    # TODO: find a way to include a button like richtext content
    # __name__ = 'richtextcontent'

    content = MarkupMirrorField(
        verbose_name=_("Markup content"),

    class Meta:
        abstract = True
        app_label = 'wienfluss'
        verbose_name = _("Markup content")
        verbose_name_plural = _("Markup content")

    def render(self, **kwargs):
        request = kwargs.get('request')
        return render_to_string('content/markupmirror/default.html', {
            'content': self,
            'request': request