1 # -*- coding: utf-8 -*-
2 from django.forms import CharField, ValidationError
3 from .text.textilepl import textile_pl
6 from markupfield.fields import MarkupField
10 def validate_textile(value):
14 raise ValidationError('Syntax error in markup.')
17 class TextileFormField(CharField):
18 default_validators = [validate_textile]
21 class TextileField(MarkupField):
22 def formfield(self, **kwargs):
23 defaults = {'form_class': TextileFormField}
24 defaults.update(kwargs)
25 return super(MarkupField, self).formfield(**defaults)