From ff7d97b67cf1d7b59d99e07e5bb49c82d94e545c Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Mon, 24 Oct 2016 18:22:56 +0200 Subject: [PATCH 1/2] Fix slug generation in wizard --- HISTORY.rst | 1 + djangocms_blog/models.py | 2 ++ tests/test_models.py | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index 5b12d2d..0b81fa2 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -9,6 +9,7 @@ History ****************** * Optimized querysets +* Fixed slug generation in wizard ****************** 0.8.8 (2016-09-04) diff --git a/djangocms_blog/models.py b/djangocms_blog/models.py index 8ace18e..706be47 100644 --- a/djangocms_blog/models.py +++ b/djangocms_blog/models.py @@ -221,6 +221,8 @@ class Post(KnockerModel, ModelMeta, TranslatableModel): """ if self.publish and self.date_published is None: self.date_published = timezone.now() + if not self.slug and self.title: + self.slug = slugify(self.title) super(Post, self).save(*args, **kwargs) def save_translation(self, translation, *args, **kwargs): diff --git a/tests/test_models.py b/tests/test_models.py index 26d3c1a..a03dd1e 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -439,6 +439,10 @@ class AdminTest(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): self.get_pages() From ab66b1307b052e8ef25eca567441e4208ea8a876 Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Mon, 24 Oct 2016 18:57:05 +0200 Subject: [PATCH 2/2] Ping djangocms-admin-style in tox --- tox.ini | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tox.ini b/tox.ini index c5d4231..f61b3bb 100644 --- a/tox.ini +++ b/tox.ini @@ -11,21 +11,25 @@ deps = django16: django-filer<1.2 django16: cmsplugin-filer<1.1 django16: django-haystack<2.5 + django16: djangocms-admin-style<1.2 django17: Django>=1.7,<1.8 django17: django-mptt<0.8 django17: django-filer<1.3 django17: cmsplugin-filer<1.2 django17: django-haystack + django17: djangocms-admin-style<1.2 django18: Django>=1.8,<1.9 django18: django-mptt>=0.8 django18: django-filer<1.3 django18: cmsplugin-filer<1.2 django18: django-haystack + django18: djangocms-admin-style>1.2,<1.3 django19: Django>=1.9,<1.10 django19: django-mptt>=0.8 django19: django-filer<1.3 django19: cmsplugin-filer<1.2 django19: django-haystack + django19: djangocms-admin-style>1.2,<1.3 cms30: https://github.com/divio/django-cms/archive/release/3.0.x.zip cms30: djangocms-text-ckeditor<2.8 cms31: https://github.com/divio/django-cms/archive/release/3.1.x.zip