Commit 64626559 by Matjaz Gregoric

Increase slug size from 50 to 255.

In edx-platform, default course wiki article's slug is automatically set
to "{org}.{number}.{run}", which can be more than 50 characters long.

The wiki breaks if the automatically assigned slug is longer than 50
characters.

We usually use 255 character size for columns that store course_key in
edx-platform, so I believe it makes sense to use a limit of 255 for wiki
slugs, too.
parent 4a3dc1f1
...@@ -29,7 +29,7 @@ package_data = dict( ...@@ -29,7 +29,7 @@ package_data = dict(
setup( setup(
name = "django-wiki", name = "django-wiki",
version = "0.0.8", version = "0.0.9",
author = "Benjamin Bach", author = "Benjamin Bach",
author_email = "benjamin@overtag.dk", author_email = "benjamin@overtag.dk",
description = ("A wiki system written for the Django framework."), description = ("A wiki system written for the Django framework."),
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wiki', '0003_ip_address_conv'),
]
operations = [
migrations.AlterField(
model_name='urlpath',
name='slug',
field=models.SlugField(max_length=255, null=True, verbose_name='slug', blank=True),
),
]
...@@ -41,7 +41,9 @@ class URLPath(MPTTModel): ...@@ -41,7 +41,9 @@ class URLPath(MPTTModel):
article = models.ForeignKey(Article, on_delete=models.CASCADE, editable=False, article = models.ForeignKey(Article, on_delete=models.CASCADE, editable=False,
verbose_name=_(u'Cache lookup value for articles')) verbose_name=_(u'Cache lookup value for articles'))
SLUG_MAX_LENGTH = 50 # The slug is constructed from course key and will in practice be much shorter then 255 characters
# since course keys are capped at 65 characters in the Studio (https://openedx.atlassian.net/browse/TNL-889).
SLUG_MAX_LENGTH = 255
slug = models.SlugField(verbose_name=_(u'slug'), null=True, blank=True, slug = models.SlugField(verbose_name=_(u'slug'), null=True, blank=True,
max_length=SLUG_MAX_LENGTH) max_length=SLUG_MAX_LENGTH)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment