Allow allow_unicode slug field
This commit is contained in:
parent
cbd64d2e43
commit
8d446ec0c0
2 changed files with 22 additions and 2 deletions
20
djangocms_blog/migrations/0032_auto_20170509_1831.py
Normal file
20
djangocms_blog/migrations/0032_auto_20170509_1831.py
Normal 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'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -172,7 +172,7 @@ class Post(SortableMixin, KnockerModel, ModelMeta, TranslatableModel):
|
||||||
|
|
||||||
translations = TranslatedFields(
|
translations = TranslatedFields(
|
||||||
title=models.CharField(_('title'), max_length=255),
|
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=''),
|
abstract=HTMLField(_('abstract'), blank=True, default=''),
|
||||||
meta_description=models.TextField(verbose_name=_('post meta description'),
|
meta_description=models.TextField(verbose_name=_('post meta description'),
|
||||||
blank=True, default=''),
|
blank=True, default=''),
|
||||||
|
@ -258,7 +258,7 @@ class Post(SortableMixin, 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:
|
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)
|
super(Post, self).save(*args, **kwargs)
|
||||||
|
|
||||||
def save_translation(self, translation, *args, **kwargs):
|
def save_translation(self, translation, *args, **kwargs):
|
||||||
|
|
Loading…
Reference in a new issue