Commit 4783abda by benjaoming

Only force new slugs to lowercase when not URL_CASE_SENSITIVE

parent 42b6c490
......@@ -256,6 +256,8 @@ class CreateForm(forms.Form, SpamProtectionMixin):
if settings.URL_CASE_SENSITIVE:
already_existing_slug = models.URLPath.objects.filter(slug=slug, parent=self.urlpath_parent)
else:
slug = slug.lower()
slug = slug.replace('-', '_')
already_existing_slug = models.URLPath.objects.filter(slug__iexact=slug, parent=self.urlpath_parent)
if already_existing_slug:
already_urlpath = already_existing_slug[0]
......@@ -264,8 +266,6 @@ class CreateForm(forms.Form, SpamProtectionMixin):
else:
raise forms.ValidationError(_(u'A slug named "%s" already exists.') % already_urlpath.slug)
slug = slug.lower()
slug = slug.replace('-', '_')
return slug
def clean(self):
......
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