mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #29746 -- Fixed misleading FlatpageForm URL help text if APPEND_SLASH is disabled.
This commit is contained in:
parent
5195b99e2c
commit
a43cfc23d4
2 changed files with 24 additions and 3 deletions
|
@ -49,6 +49,11 @@ class FlatpageAdminFormTests(TestCase):
|
|||
def test_flatpage_requires_trailing_slash_with_append_slash(self):
|
||||
form = FlatpageForm(data=dict(url='/no_trailing_slash', **self.form_data))
|
||||
with translation.override('en'):
|
||||
self.assertEqual(
|
||||
form.fields['url'].help_text,
|
||||
"Example: '/about/contact/'. Make sure to have leading and "
|
||||
"trailing slashes."
|
||||
)
|
||||
self.assertFalse(form.is_valid())
|
||||
self.assertEqual(form.errors['url'], ["URL is missing a trailing slash."])
|
||||
|
||||
|
@ -56,6 +61,11 @@ class FlatpageAdminFormTests(TestCase):
|
|||
def test_flatpage_doesnt_requires_trailing_slash_without_append_slash(self):
|
||||
form = FlatpageForm(data=dict(url='/no_trailing_slash', **self.form_data))
|
||||
self.assertTrue(form.is_valid())
|
||||
with translation.override('en'):
|
||||
self.assertEqual(
|
||||
form.fields['url'].help_text,
|
||||
"Example: '/about/contact'. Make sure to have a leading slash."
|
||||
)
|
||||
|
||||
def test_flatpage_admin_form_url_uniqueness_validation(self):
|
||||
"The flatpage admin form correctly enforces url uniqueness among flatpages of the same site"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue