Fix slug fields length due to mysql utf8mb4 encoding
This commit is contained in:
parent
c4d1466539
commit
747ec23686
3 changed files with 12 additions and 12 deletions
|
@ -21,12 +21,12 @@ class Migration(migrations.Migration):
|
|||
migrations.AlterField(
|
||||
model_name='blogcategorytranslation',
|
||||
name='name',
|
||||
field=models.CharField(max_length=2000, verbose_name='name'),
|
||||
field=models.CharField(max_length=767, verbose_name='name'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='blogcategorytranslation',
|
||||
name='slug',
|
||||
field=models.SlugField(blank=True, max_length=2000, verbose_name='slug'),
|
||||
field=models.SlugField(blank=True, max_length=767, verbose_name='slug'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='posttranslation',
|
||||
|
@ -36,11 +36,11 @@ class Migration(migrations.Migration):
|
|||
migrations.AlterField(
|
||||
model_name='posttranslation',
|
||||
name='slug',
|
||||
field=djangocms_blog.fields.AutoSlugField(allow_unicode=True, blank=True, db_index=False, max_length=2000, verbose_name='slug'),
|
||||
field=djangocms_blog.fields.AutoSlugField(allow_unicode=True, blank=True, db_index=False, max_length=767, verbose_name='slug'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='posttranslation',
|
||||
name='title',
|
||||
field=models.CharField(max_length=2000, verbose_name='title'),
|
||||
field=models.CharField(max_length=767, verbose_name='title'),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -92,8 +92,8 @@ class BlogCategory(BlogMetaMixin, TranslatableModel):
|
|||
)
|
||||
|
||||
translations = TranslatedFields(
|
||||
name=models.CharField(_('name'), max_length=2000),
|
||||
slug=models.SlugField(_('slug'), max_length=2000, blank=True, db_index=True),
|
||||
name=models.CharField(_('name'), max_length=767),
|
||||
slug=models.SlugField(_('slug'), max_length=767, blank=True, db_index=True),
|
||||
meta_description=models.TextField(
|
||||
verbose_name=_('category meta description'), blank=True, default=''
|
||||
),
|
||||
|
@ -227,8 +227,8 @@ class Post(KnockerModel, BlogMetaMixin, TranslatableModel):
|
|||
)
|
||||
|
||||
translations = TranslatedFields(
|
||||
title=models.CharField(_('title'), max_length=2000),
|
||||
slug=AutoSlugField(_('slug'), max_length=2000, blank=True,
|
||||
title=models.CharField(_('title'), max_length=767),
|
||||
slug=AutoSlugField(_('slug'), max_length=767, blank=True,
|
||||
db_index=True, allow_unicode=True),
|
||||
abstract=HTMLField(_('abstract'), blank=True, default=''),
|
||||
meta_description=models.TextField(verbose_name=_('post meta description'),
|
||||
|
|
|
@ -82,12 +82,12 @@ class AdminTest(BaseTest):
|
|||
|
||||
# Add view only contains the apphook selection widget
|
||||
response = post_admin.add_view(request)
|
||||
self.assertNotContains(response, '<input id="id_slug" maxlength="2000" name="slug" type="text"')
|
||||
self.assertNotContains(response, '<input id="id_slug" maxlength="767" name="slug" type="text"')
|
||||
self.assertContains(response, '<option value="%s">Blog / sample_app</option>' % self.app_config_1.pk)
|
||||
|
||||
# Changeview is 'normal'
|
||||
response = post_admin.change_view(request, str(post.pk))
|
||||
self.assertContains(response, '<input id="id_slug" maxlength="2000" name="slug" type="text" value="first-post" />')
|
||||
self.assertContains(response, '<input id="id_slug" maxlength="767" name="slug" type="text" value="first-post" />')
|
||||
self.assertContains(response, 'id="id_meta_description" maxlength="320"')
|
||||
self.assertContains(response, '<option value="%s" selected="selected">Blog / sample_app</option>' % self.app_config_1.pk)
|
||||
|
||||
|
@ -184,12 +184,12 @@ class AdminTest(BaseTest):
|
|||
|
||||
# Add view only has an empty form - no type
|
||||
response = category_admin.add_view(request)
|
||||
self.assertNotContains(response, 'id="id_name" maxlength="2000" name="name" type="text" value="category 1"')
|
||||
self.assertNotContains(response, 'id="id_name" maxlength="767" name="name" type="text" value="category 1"')
|
||||
self.assertContains(response, '<option value="%s">Blog / sample_app</option>' % self.app_config_1.pk)
|
||||
|
||||
# Changeview is 'normal', with a few preselected items
|
||||
response = category_admin.change_view(request, str(self.category_1.pk))
|
||||
self.assertContains(response, 'id="id_name" maxlength="2000" name="name" type="text" value="category 1"')
|
||||
self.assertContains(response, 'id="id_name" maxlength="767" name="name" type="text" value="category 1"')
|
||||
self.assertContains(response, 'id="id_meta_description" maxlength="320"')
|
||||
self.assertContains(response, '<option value="%s" selected="selected">Blog / sample_app</option>' % self.app_config_1.pk)
|
||||
|
||||
|
|
Loading…
Reference in a new issue