@@ -0,0 +1,970 @@
+from django.utils.text import slugify%0A%0A'''%0Arandom_string_generator is located here:%0Ahttp://joincfe.com/blog/random-string-generator-in-python/%0A'''%0Aimport random%0Aimport string%0A%0Adef random_string_generator(size=10, chars=string.ascii_lowercase + string.digits):%0A    return ''.join(random.choice(chars) for _ in range(size))%0A%0Adef unique_slug_generator(instance, new_slug=None):%0A    %22%22%22%0A    This is for a Django project and it assumes your instance %0A    has a model with a slug field and a title character (char) field.%0A    %22%22%22%0A    if new_slug is not None:%0A        slug = new_slug%0A    else:%0A        slug = slugify(instance.title)%0A%0A    Klass = instance.__class__%0A    qs_exists = Klass.objects.filter(slug=slug).exists()%0A    if qs_exists:%0A        new_slug = %22%7Bslug%7D-%7Brandstr%7D%22.format(%0A                    slug=slug,%0A                    randstr=random_string_generator(size=4)%0A                )%0A        return unique_slug_generator(instance, new_slug=new_slug)%0A    return slug%0A

Create utils.py