Include test key data by default on platform admin

This is the existing behaviour. It’s broken by this issue in WTForms
2.2.1: https://github.com/wtforms/wtforms/issues/401

This commit hand-crafts the default value, because WTForms is ignoring
the `default` argument on the form object attribute.

Not really sure how this ever worked 🤔
This commit is contained in:
Chris Hill-Scott
2018-08-03 14:30:34 +01:00
parent 0d2de75e84
commit 55054b81b5
2 changed files with 20 additions and 8 deletions

View File

@@ -138,6 +138,14 @@ def make_columns(global_stats, complaints_number):
@user_is_platform_admin
def platform_admin_services():
form = DateFilterForm(request.args)
if all((
request.args.get('include_from_test_key') is None,
request.args.get('start_date') is None,
request.args.get('end_date') is None,
)):
# Default to True if the user hasnt done any filtering,
# otherwise respect their choice
form.include_from_test_key.data = True
api_args = {'detailed': True,
'only_active': False, # specifically DO get inactive services
'include_from_test_key': form.include_from_test_key.data,