Skip to content
Shipu Ahamed edited this page Sep 3, 2016 · 2 revisions

unique

This is a boolean defining whether slugs should be unique among all models of the given type. For example, if you have two blog posts and both are called "My Blog Post", then they will both sluggify to "my-blog-post" if unique is false. This could be a problem, e.g. if you use the slug in URLs.

By setting unique to true, then the second Post model will sluggify to "my-blog-post-1". If there is a third post with the same title, it will sluggify to "my-blog-post-2" and so on. Each subsequent model will get an incremental value appended to the end of the slug, ensuring uniqueness.

Clone this wiki locally