Auto generating a random clean URL (slug URL) for django web application. In URL www.website.com/app/d4Ers
the last part is auto generated random string.
We need to first install the following package
$ sudo pip install django-autoslug
then import the package
from autoslug.fields import AutoSlugField
In the model class add a field
url_ref = AutoSlugField(slugify=lambda instance: ''.join(random.sample(string.uppercase + string.lowercase + string.digits, 5)), unique=True)
Hope this helps.