From 457fc9e47fa20e120aa30171ad0c388aebddf5d2 Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Mon, 25 Oct 2021 13:43:50 +0200 Subject: [PATCH] data: allow blank values for urls in site settings (#58152) --- combo/data/migrations/0049_sitesettings.py | 2 ++ combo/data/models.py | 2 ++ tests/test_manager.py | 8 ++++++++ 3 files changed, 12 insertions(+) diff --git a/combo/data/migrations/0049_sitesettings.py b/combo/data/migrations/0049_sitesettings.py index f6577d15..4a03999b 100644 --- a/combo/data/migrations/0049_sitesettings.py +++ b/combo/data/migrations/0049_sitesettings.py @@ -23,6 +23,7 @@ class Migration(migrations.Migration): max_length=100, verbose_name='Initial login page path', help_text='Page to redirect to the first time user logs in.', + blank=True, ), ), ( @@ -31,6 +32,7 @@ class Migration(migrations.Migration): max_length=100, verbose_name='Welcome page path', help_text='Page to redirect to on the first visit, to suggest user to log in.', + blank=True, ), ), ], diff --git a/combo/data/models.py b/combo/data/models.py index 8640e03b..aff99173 100644 --- a/combo/data/models.py +++ b/combo/data/models.py @@ -2211,9 +2211,11 @@ class SiteSettings(models.Model): _('Welcome page path'), help_text=_('Page to redirect to on the first visit, to suggest user to log in.'), max_length=100, + blank=True, ) initial_login_page_path = models.CharField( _('Initial login page path'), help_text=_('Page to redirect to the first time user logs in.'), max_length=100, + blank=True, ) diff --git a/tests/test_manager.py b/tests/test_manager.py index 310bacd3..8ccf43a0 100644 --- a/tests/test_manager.py +++ b/tests/test_manager.py @@ -2650,3 +2650,11 @@ def test_site_settings(app, admin_user): site_settings = SiteSettings.objects.get() assert site_settings.welcome_page_path == '/welcome/' assert site_settings.initial_login_page_path == '/initial-login/' + + resp.form['welcome_page_path'] = '' + resp.form['initial_login_page_path'] = '' + resp.form.submit() + + site_settings.refresh_from_db() + assert site_settings.welcome_page_path == '' + assert site_settings.initial_login_page_path == '' -- 2.30.2