Generating unique slug in Django
问题 I have seen a variety of different methods for generating unique slugs: Ex. 1, Ex.2, Ex. 3, Ex. 4, etc. etc. I want to create unique slugs upon saving a ModelForm. If my models are like: class Phone(models.Model): user = models.ForeignKey(User) slug = models.SlugField(max_length=70, unique=True) year = models.IntegerField() model = models.ForeignKey('Model') series = models.ForeignKey('Series') Say that the Phone object has the following values (via submitted ModelForm): Phone.user = dude