signals.post_save.connect(create_slug, sender=Articles)
def create_slug(sender, instance, signal, *args, **kwargs):
if instance.id and hasattr(instance, 'slug_field_name') and hasattr(instance, 'slug_from'):
slug_name = instance.slug_field_name
slug_from = instance.slug_from
if not getattr(instance, slug_name, None):
slug = '%s-' % instance.id + slugify(getattr(instance, slug_from))
setattr(instance, slug_name, slug)
instance.save()