Esempio n. 1
0
 def clean_description(self):
     value = self.cleaned_data['description']
     field = XHTMLField()
     if len(re.sub(r'[^\w\s]', '', 
                   xhtml_to_text(field.to_python(value)))) == 0:
         raise ValidationError('This field is required.')
     return value
Esempio n. 2
0
 def save(self, *args, **kwargs):
     self.ordering = re.sub(r'[^\w\s]', '', utils.xhtml_to_text(self.description))[:32]
     super(Document, self).save(*args, **kwargs)
Esempio n. 3
0
 def as_text(self):
     footnoted_text = self.footnoted_text()
     if footnoted_text is None:
         return utils.xhtml_to_text(self.content)
     else:
         return footnoted_text
Esempio n. 4
0
 def as_text(self):
     return utils.xhtml_to_text(self.description)