As of today, each post's url in the address bar is a slug such as 'adding-slugified-urls' instead of the post id...e.g.


This improves SEO (and makes the share links a lot more comprehensible). This involved modifying A LOT of files and broke tons of stuff before I fixed it. Here is an example of how my changed:

Code changes needed to slugify posts. The left side of the image shows the before and the right side shows the after.

After adding a new slug field to the post model, you add it to the post form as a text field. This allows you  to set the slug to whatever you want.

Create post view showing slug field

Because the url changes, you need to update all of your templates so the hrefs to posts reference the post.slug instead of

Finally, an update to file ensures a db lookup of a post used the slug for a unique lookup instead of the post id.

post = Post.objects.get(slug=self.object.slug)

Everything seems works so far!