def do_unique_slug(self, using=DEFAULT_DB):
"""
Ensures that the slug is always unique for the year this article was
posted
"""
if not self.id:
# make sure we have a slug first
if not len(self.slug.strip()):
self.slug = slugify(self.title)
self.slug = self.get_unique_slug(self.slug, using)
return True
return False
评论列表
文章目录