title: Adding Unique Slug in Django
body: <p>I'm trying to add a slug field in my school project, Here's what I tried in my model,</p>
  
  <pre><code>def pre_save_receiver(sender, instance, *args, **kwargs):
  
     slug = slugify(instance.title)
     exists = Data.objects.filter(slug=slug).exists()
     if exists:
        instance.slug = "%s-%s" % (slug, instance.id)
     else:
        instance.slug = slug
  
  
  
  pre_save.connect(pre_save_receiver, sender=Data)
  </code></pre>
  
  <p>Everything is working fine but the problem is that it's adding ID in slug field behind even if it's Unique. 
  How can I fix that?</p>