Fix slug generation in wizard
This commit is contained in:
parent
78001259a1
commit
ff7d97b67c
|
@ -9,6 +9,7 @@ History
|
||||||
******************
|
******************
|
||||||
|
|
||||||
* Optimized querysets
|
* Optimized querysets
|
||||||
|
* Fixed slug generation in wizard
|
||||||
|
|
||||||
******************
|
******************
|
||||||
0.8.8 (2016-09-04)
|
0.8.8 (2016-09-04)
|
||||||
|
|
|
@ -221,6 +221,8 @@ class Post(KnockerModel, ModelMeta, TranslatableModel):
|
||||||
"""
|
"""
|
||||||
if self.publish and self.date_published is None:
|
if self.publish and self.date_published is None:
|
||||||
self.date_published = timezone.now()
|
self.date_published = timezone.now()
|
||||||
|
if not self.slug and self.title:
|
||||||
|
self.slug = slugify(self.title)
|
||||||
super(Post, self).save(*args, **kwargs)
|
super(Post, self).save(*args, **kwargs)
|
||||||
|
|
||||||
def save_translation(self, translation, *args, **kwargs):
|
def save_translation(self, translation, *args, **kwargs):
|
||||||
|
|
|
@ -439,6 +439,10 @@ class AdminTest(BaseTest):
|
||||||
|
|
||||||
class ModelsTest(BaseTest):
|
class ModelsTest(BaseTest):
|
||||||
|
|
||||||
|
def test_slug(self):
|
||||||
|
post = Post.objects.language('en').create(title='I am a title')
|
||||||
|
self.assertEqual(post.slug, 'i-am-a-title')
|
||||||
|
|
||||||
def test_model_attributes(self):
|
def test_model_attributes(self):
|
||||||
self.get_pages()
|
self.get_pages()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue