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)
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