Using a slug in Django
Generating slugs automatically in Django without packages - Two easy and solid approaches Image: Slugs in Django (License: CC-BY-SA Marcelo Canina) Slug generation management Overview One important task when developing a Django website is to have pretty URL s , i.e.: human readable and SEO friendly URLs . A site's URL structure should be as simple as possible. Consider organizing your content so that URLs are constructed logically and in a manner that is most intelligible to humans (when possible, readable words rather than long ID numbers) Keep a simple URL structure Google Webmasters Options We will explore two approaches to have clean URLs , from having the typical Django’s URLs with the object/pk scheme, like /article/12345 to have one of these: pk and slugs : object/pk-slug like /article/12345-my-example-title where we add the object’s slug after the primary key. unique slug : generate a unique slugs with...