Allow allow_unicode slug field

This commit is contained in:
Dipen Patel 2017-05-09 18:33:18 +05:30
parent cbd64d2e43
commit 8d446ec0c0
2 changed files with 22 additions and 2 deletions

View file

@ -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'),
),
]

View file

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