data: allow blank values for urls in site settings (#58152)

This commit is contained in:
Valentin Deniaud 2021-10-25 13:43:50 +02:00
parent 4fd2151477
commit 457fc9e47f
3 changed files with 12 additions and 0 deletions

View File

@ -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,
),
),
],

View File

@ -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,
)

View File

@ -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 == ''