Skip to content

Commit

Permalink
Merge pull request #22 from open-craft/mtyaka/increase-slug-size
Browse files Browse the repository at this point in the history
Increase slug max size
  • Loading branch information
mtyaka committed Aug 24, 2016
2 parents cdd6999 + 6462655 commit f57db71
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def build_media_pattern(base_folder, file_extension):

setup(
name = "django-wiki",
version = "0.0.8",
version = "0.0.9",
author = "Benjamin Bach",
author_email = "[email protected]",
description = ("A wiki system written for the Django framework."),
Expand Down
3 changes: 2 additions & 1 deletion wiki/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ def __init__(self, urlpath_parent, *args, **kwargs):
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

Expand Down
19 changes: 19 additions & 0 deletions wiki/migrations/0004_increase_slug_size.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- 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),
),
]
7 changes: 6 additions & 1 deletion wiki/models/urlpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down

0 comments on commit f57db71

Please sign in to comment.