I've been trying slugify a CharField in my models. I've followed this tutorial but I've only managed to get a Database error. "column article_article.slug does not exist. I'm aware of South and migrations but I'm I haven't used it properly. Basically I have a blog application and each post is identified by an ID number. I want to slugify the titles for each blog post.
Here's my views.py
def article(request, article_id =1):
return render_to response('article.html', {'article':Article.Objects.get(id=article_id)}, context_instance=ResquestContext(request))
Here's my models.py
class Article(models.Model):
title = models.CharField(max_length=30) #<--want to slugify this
body = models.TextField()
pub_date = models.DateTimeField('date published')
likes = models.IntegerField(default = 0)
def __unicode__(self):
return self.title
Here's my urls.py
...
url(r'^get/(?P<article_id>\d+)/$', 'article.views.article'),
...
Here's my articles.html
...
<a id = "title2" href="articles/get{{ article.id }} /"> {{ article.title }} </a>
...