From 8d446ec0c077804dcc901135cd8599af8f9aeab6 Mon Sep 17 00:00:00 2001 From: Dipen Patel Date: Tue, 9 May 2017 18:33:18 +0530 Subject: [PATCH] Allow allow_unicode slug field --- .../migrations/0032_auto_20170509_1831.py | 20 +++++++++++++++++++ djangocms_blog/models.py | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 djangocms_blog/migrations/0032_auto_20170509_1831.py diff --git a/djangocms_blog/migrations/0032_auto_20170509_1831.py b/djangocms_blog/migrations/0032_auto_20170509_1831.py new file mode 100644 index 0000000..05bd4c6 --- /dev/null +++ b/djangocms_blog/migrations/0032_auto_20170509_1831.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-05-09 13:01 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('djangocms_blog', '0031_auto_20170411_1719'), + ] + + operations = [ + migrations.AlterField( + model_name='posttranslation', + name='slug', + field=models.SlugField(allow_unicode=True, blank=True, max_length=255, verbose_name='slug'), + ), + ] diff --git a/djangocms_blog/models.py b/djangocms_blog/models.py index 1be2cd4..fe3c6c5 100644 --- a/djangocms_blog/models.py +++ b/djangocms_blog/models.py @@ -172,7 +172,7 @@ class Post(SortableMixin, KnockerModel, ModelMeta, TranslatableModel): translations = TranslatedFields( title=models.CharField(_('title'), max_length=255), - slug=models.SlugField(_('slug'), max_length=255, blank=True, db_index=True), + slug=models.SlugField(_('slug'), max_length=255, blank=True, db_index=True, allow_unicode=True), abstract=HTMLField(_('abstract'), blank=True, default=''), meta_description=models.TextField(verbose_name=_('post meta description'), blank=True, default=''), @@ -258,7 +258,7 @@ class Post(SortableMixin, 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) + self.slug = slugify(self.title, allow_unicode=True) super(Post, self).save(*args, **kwargs) def save_translation(self, translation, *args, **kwargs):