How i can generate random slug consisting of the smallest amount of characters. i try with this.
import random
import string
u_id = ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(8))
and model
class Articles(models.Model):
slug = models.CharField(max_length=6)
How i can do this in model? Generate slug, check if is available and set. I want create short slugs lenght 1 to 6 chars, best for me is starting from 1 letter slugs.
Aucun commentaire:
Enregistrer un commentaire