def get_publish_date(sender, instance, *args, **kwargs): if instance.active and not instance.published_date: instance.published_date = timezone.now() if not instance.active and instance.published_date: instance.published_date = None if not instance.slug: instance.slug = unique_slug_generator(instance)
def pre_save_action(sender, instance, *args, **kwargs): content = instance.content if len(content) <= 40: slug = content else: slug = content[:40] if not instance.slug: instance.slug = unique_slug_generator(instance, new_slug=slugify(slug))
def tag_pre_save_receiver(sender, instance, *args, **kwargs): if not instance.slug: instance.slug = unique_slug_generator(instance)
def product_presave_reciever(sender, instance, *args, **kwargs): # if not already created -> create it if not instance.slug: # generate a unique slug name instance.slug = unique_slug_generator(instance)
def product_pre_save_reciever(sender, instance, *args, **kwargs): if not instance.slug: instance.slug = unique_slug_generator(instance)