Commit f57db71c by Matjaz Gregoric Committed by GitHub

Merge pull request #22 from open-craft/mtyaka/increase-slug-size

Increase slug max size
parents cdd6999f 64626559
......@@ -29,7 +29,7 @@ package_data = dict(
setup(
name = "django-wiki",
version = "0.0.8",
version = "0.0.9",
author = "Benjamin Bach",
author_email = "benjamin@overtag.dk",
description = ("A wiki system written for the Django framework."),
......
......@@ -203,7 +203,8 @@ class CreateForm(forms.Form):
self.urlpath_parent = urlpath_parent
title = forms.CharField(label=_(u'Title'),)
slug = forms.SlugField(label=_(u'Slug'), help_text=_(u"This will be the address where your article can be found. Use only alphanumeric characters and - or _. Note that you cannot change the slug after creating the article."),)
slug = forms.SlugField(label=_(u'Slug'), help_text=_(u"This will be the address where your article can be found. Use only alphanumeric characters and - or _. Note that you cannot change the slug after creating the article."),
max_length=models.URLPath.SLUG_MAX_LENGTH)
content = forms.CharField(label=_(u'Contents'),
required=False, widget=getEditor().get_widget()) #@UndefinedVariable
......
# -*- 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,12 @@ class URLPath(MPTTModel):
article = models.ForeignKey(Article, on_delete=models.CASCADE, editable=False,
verbose_name=_(u'Cache lookup value for articles'))
slug = models.SlugField(verbose_name=_(u'slug'), null=True, blank=True)
# 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,
max_length=SLUG_MAX_LENGTH)
site = models.ForeignKey(Site)
parent = TreeForeignKey('self', null=True, blank=True, related_name='children')
......
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