def pre_save(self, instance, *args, **kwargs): from django.utils.text import slugify if not instance.slug: instance.slug = slugify(self.slug_source)