Merge pull request #336 from nephila/hotfix/slug_generation

Fix slug generation in wizard
This commit is contained in:
Iacopo Spalletti 2016-10-25 09:12:27 +02:00 committed by GitHub
commit 9e057a3962
4 changed files with 11 additions and 0 deletions

View file

@ -9,6 +9,7 @@ History
******************
* Optimized querysets
* Fixed slug generation in wizard
******************
0.8.8 (2016-09-04)

View file

@ -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):

View file

@ -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()

View file

@ -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