mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-03-16 22:10:28 +00:00
Make server-side slug generation respect WAGTAIL_ALLOW_UNICODE_SLUGS (#5808)
This commit is contained in:
parent
afd707f6b4
commit
47f677577e
5 changed files with 18 additions and 2 deletions
|
|
@ -5,12 +5,13 @@ Changelog
|
|||
~~~~~~~~~~~~~~~~
|
||||
|
||||
* Reduced contrast of rich text toolbar (Jack Paine)
|
||||
* Support the rel attribute on custom ModelAdmin buttons (Andy Chosak)
|
||||
* Server-side page slug generation now respects `WAGTAIL_ALLOW_UNICODE_SLUGS` (Arkadiusz Michał Ryś)
|
||||
* Fix: Added ARIA alert role to live search forms in the admin (Casper Timmers)
|
||||
* Fix: Reorder login form elements to match expected tab order (Kjartan Sverrisson)
|
||||
* Fix: Re-add 'Close Explorer' button on mobile viewports (Sævar Öfjörð Magnússon)
|
||||
* Fix: Add a more descriptive label to Password reset link for screen reader users (Casper Timmers, Martin Coote)
|
||||
* Fix: Improve Wagtail logo contrast by adding a background (Brian Edelman, Simon Evans, Ben Enright)
|
||||
* Support the rel attribute on custom ModelAdmin buttons (Andy Chosak)
|
||||
|
||||
|
||||
2.8 (03.02.2020)
|
||||
|
|
|
|||
|
|
@ -430,6 +430,7 @@ Contributors
|
|||
* Eric Sherman
|
||||
* Martin Coote
|
||||
* Simon Evans
|
||||
* Arkadiusz Michał Ryś
|
||||
|
||||
Translators
|
||||
===========
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ Other features
|
|||
|
||||
* Reduced contrast of rich text toolbar (Jack Paine)
|
||||
* Support the rel attribute on custom ModelAdmin buttons (Andy Chosak)
|
||||
* Server-side page slug generation now respects ``WAGTAIL_ALLOW_UNICODE_SLUGS`` (Arkadiusz Michał Ryś)
|
||||
|
||||
|
||||
Bug fixes
|
||||
|
|
|
|||
|
|
@ -431,7 +431,8 @@ class Page(AbstractPage, index.Indexed, ClusterableModel, metaclass=PageBase):
|
|||
|
||||
if not self.slug:
|
||||
# Try to auto-populate slug from title
|
||||
base_slug = slugify(self.title, allow_unicode=True)
|
||||
allow_unicode = getattr(settings, 'WAGTAIL_ALLOW_UNICODE_SLUGS', True)
|
||||
base_slug = slugify(self.title, allow_unicode=allow_unicode)
|
||||
|
||||
# only proceed if we get a non-empty base slug back from slugify
|
||||
if base_slug:
|
||||
|
|
|
|||
|
|
@ -84,6 +84,18 @@ class TestValidation(TestCase):
|
|||
homepage.add_child(instance=christmas_page)
|
||||
self.assertTrue(Page.objects.filter(id=christmas_page.id).exists())
|
||||
|
||||
@override_settings(WAGTAIL_ALLOW_UNICODE_SLUGS=True)
|
||||
def test_slug_generation_respects_unicode_setting_true(self):
|
||||
page = Page(title="A mööse bit me önce")
|
||||
Page.get_first_root_node().add_child(instance=page)
|
||||
self.assertEqual(page.slug, 'a-mööse-bit-me-önce')
|
||||
|
||||
@override_settings(WAGTAIL_ALLOW_UNICODE_SLUGS=False)
|
||||
def test_slug_generation_respects_unicode_setting_false(self):
|
||||
page = Page(title="A mööse bit me önce")
|
||||
Page.get_first_root_node().add_child(instance=page)
|
||||
self.assertEqual(page.slug, 'a-moose-bit-me-once')
|
||||
|
||||
def test_get_admin_display_title(self):
|
||||
homepage = Page.objects.get(url_path='/home/')
|
||||
self.assertEqual(homepage.draft_title, homepage.get_admin_display_title())
|
||||
|
|
|
|||
Loading…
Reference in a new issue