def save(self, *args, **kwargs): if not self.slug: from turbion.bits.utils.text import slugify self.slug = slugify(self.title) self.edited_on = datetime.now() super(Post, self).save(*args, **kwargs)
def _get_val_from_obj(self, obj): from turbion.bits.utils.text import slugify if obj: val = getattr(obj, self.attname, None) if not val: val = slugify("".join([getattr(obj, name) for name in self.prepopulate_from if hasattr(obj, name)])) return val return self.get_default()
def save(self, *args, **kwargs): if not self.slug: from turbion.bits.utils.text import slugify self.slug = slugify(self.name) super(Tag, self).save(*args, **kwargs)