Note: Please dont consider it as duplicate post, all the existing posts are not giving clear understanding of SlugField.
My question is "we can sluggify and store the value in a CharField right? then why do we need SlugField for something that can be done easily using CharField?"
For example, in my model, I have a field called
url = models.CharField(max_length=30)
def save(self, ...):
self.url = slugify(self.url)
.......
Won't the url be saved in slugified format in database? I can use this slugified value in browser right, then what is the use of creating models.SlugFIeld(max_length=30)? What advantage SlugField will add over slugified CharField?
In above code, how replacing "CharField" with "SlugField" be advantageous?