From b58eca2a2bab4853d8037f48f405fe67a7091d14 Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Tue, 5 Mar 2019 22:20:03 +0100 Subject: [PATCH] fix allow_unicode kwarg for AutoSlugField (#482) --- djangocms_blog/fields.py | 5 +++-- .../migrations/0036_auto_20180913_1809.py | 21 +++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 djangocms_blog/migrations/0036_auto_20180913_1809.py diff --git a/djangocms_blog/fields.py b/djangocms_blog/fields.py index e6dfd0f2..3ca6aa6e 100644 --- a/djangocms_blog/fields.py +++ b/djangocms_blog/fields.py @@ -10,8 +10,9 @@ class AutoSlugField(SlugField): def __init__(self, *args, **kwargs): - self.allow_unicode = kwargs.pop('allow_unicode', False) - super(SlugField, self).__init__(*args, **kwargs) + if django.VERSION < (1, 9): + self.allow_unicode = kwargs.pop('allow_unicode', False) + super(AutoSlugField, self).__init__(*args, **kwargs) def slugify(base): diff --git a/djangocms_blog/migrations/0036_auto_20180913_1809.py b/djangocms_blog/migrations/0036_auto_20180913_1809.py new file mode 100644 index 00000000..8aa963aa --- /dev/null +++ b/djangocms_blog/migrations/0036_auto_20180913_1809.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.15 on 2018-09-13 18:09 +from __future__ import unicode_literals + +from django.db import migrations +import djangocms_blog.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('djangocms_blog', '0035_posttranslation_subtitle'), + ] + + operations = [ + migrations.AlterField( + model_name='posttranslation', + name='slug', + field=djangocms_blog.fields.AutoSlugField(allow_unicode=True, blank=True, max_length=767, verbose_name='slug'), + ), + ]