Answer the question
In order to leave comments, you need to log in
Signal, where is the error?
from django.db.models.signals import post_save
class Category(models.Model):
parent = models.ForeignKey('self', null=True, blank=True, related_name='children')
title = models.CharField(max_length=50)
slug = models.SlugField(max_length=70, blank=True)
def set_caregory_slug(sender, instance, *args, **kwargs):
from pytils import translit
instance.slug = translit.slugify(instance.title.strip())
post_save.connect(set_caregory_slug, sender=Category)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question