Django and Pretty URLs

SEO is very important these days. Especially for web content. I figured I better add some functionality to make the URLs pretty.

Django and Python have made this very easy for me. Since the addition of the SlugField I can easily add in a new item. You can find reference to it here:

I just added it to the

slug = models.SlugField(max_length=50)

Then updated the

url(r'^(?P\d+)/(?P[-\w\d]+)$', DetailView.as_view(

Did an Alter table to include the new column and add in the field values.
Now I have SEO friendly URLs.

comments powered by Disqus