This blog is based on the assessment found [here](https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/django_assessment_blog).
0
stars
0
forks
source link
Use slugs instead of ID in urls for the detail view of the blog post. #24
Closed
mbaechtold closed 6 years ago
It would be nicer to use slugs instead of IDs in the urls for the detail view of the blog post.
Examples: http://localhost:8000/blog/posts/1 -> http://localhost:8000/blog/posts/my-first-post http://localhost:8000/blog/posts/2 -> http://localhost:8000/blog/posts/hello-again
Maybe you could use https://pypi.org/project/django-autoslug/ if it's compatible with your versions of Django and Python.
Also write a data migration which creates the slugs (see https://docs.djangoproject.com/en/2.0/topics/migrations/#data-migrations)