Esempio n. 1
0
 def save(self, *args, **kwargs):
     """
     Create a unique slug from the title by appending an index.
     TODO: how much time spend this?
     """
     self.description = bleach_clean(self.description)
     concrete_model = base_concrete_model(BaseDescription, self)
     if not self.slug:
         self.slug = self.get_slug()
         i = 1
         while concrete_model.objects.filter(slug=self.slug).count() > 0:
             self.slug = self.get_slug() + "-%s" % i
             i += 1
     super(BaseDescription, self).save(*args, **kwargs)
Esempio n. 2
0
 def save(self, *args, **kwargs):
     self.text = bleach_clean(self.text)
     return super(Page, self).save(*args, **kwargs)