Exemple #1
0
def preview(request, markup_type):
    """
    Display posted text, rendered in HTML using specified markup.
    """
    text = request.POST.get('data', '')
    html = renderer(markup_type, text)
    ctx = RequestContext(request, {
        'html': html,
        'admin_media_prefix': settings.ADMIN_MEDIA_PREFIX,
    })
    return render_to_response('markupfield/preview.html', ctx)
Exemple #2
0
 def pre_save(self, model_instance, add):
     value = super(MarkupField, self).pre_save(model_instance, add)
     rendered = renderer(value.markup_type, value.raw)
     setattr(model_instance, _rendered_field_name(self.attname), rendered)
     return value.raw