def clean_text(self): try: backend.render_text( self.cleaned_data['text'], self.instance.language or self.default_language) except Exception, e: raise ValidationError("There is an error in the markup: %s" % e)
def render(self, request, instance, **kwargs): try: html = backend.render_text(instance.text, instance.language) except Exception as e: html = self.render_error(e) # Included in a DIV, so the next item will be displayed below. return mark_safe('<div class="markup">' + html + '</div>\n')
def render(self, request, instance, **kwargs): try: html = backend.render_text(instance.text, instance.language) except Exception, e: html = self.render_error(e)
def clean_text(self): try: backend.render_text(self.cleaned_data['text'], self.instance.language or self.default_language) except Exception as e: raise ValidationError("There is an error in the markup: %s" % e) return self.cleaned_data['text']