diff --git a/apcd_cms/src/apps/admin_exception/views.py b/apcd_cms/src/apps/admin_exception/views.py index 34fbfdef..fa14f5e3 100644 --- a/apcd_cms/src/apps/admin_exception/views.py +++ b/apcd_cms/src/apps/admin_exception/views.py @@ -115,17 +115,17 @@ def getDate(row): if entity_name not in context['org_options']: context['org_options'].append(entity_name) # to make sure All is first in the dropdown filter options after sorting alphabetically - context['org_options'] = sorted(context['org_options'], key=lambda x: (x != 'All', x)) + context['org_options'] = sorted(context['org_options'],key=lambda x: (x is not None, x != 'All', x if x is not None else '')) # Remove empty strings context['org_options'] = [option for option in context['org_options'] if option != ''] if status not in context['status_options']: if status != None: context['status_options'].append(status) # to make sure All is first in the dropdown filter options after sorting alphabetically - context['status_options'] = sorted(context['status_options'], key=lambda x: (x != 'All', x)) + context['status_options'] = sorted(context['status_options'], key=lambda x: (x is not None, x != 'All', x if x is not None else '')) if outcome not in context['outcome_options']: context['outcome_options'].append(outcome) - context['outcome_options'] = sorted(context['outcome_options'], key=lambda x: (x is not None, x)) + context['outcome_options'] = sorted(context['outcome_options'],key=lambda x: (x is not None, x != 'All', x if x is not None else '')) context['selected_status'] = None if status_filter is not None and status_filter != 'All': diff --git a/apcd_cms/src/apps/admin_extension/views.py b/apcd_cms/src/apps/admin_extension/views.py index 0c5774e0..83344653 100644 --- a/apcd_cms/src/apps/admin_extension/views.py +++ b/apcd_cms/src/apps/admin_extension/views.py @@ -108,15 +108,15 @@ def getDate(row): outcome = title_case(extension[8]) if entity_name not in context['org_options']: context['org_options'].append(entity_name) - context['org_options'] = sorted(context['org_options'], key=lambda x: (x != 'All', x)) + context['org_options'] = sorted(context['org_options'], key=lambda x: (x is not None, x != 'All', x if x is not None else '')) # Remove empty strings context['org_options'] = [option for option in context['org_options'] if option != ''] if status not in context['status_options']: context['status_options'].append(status) - context['status_options'] = sorted(context['status_options'], key=lambda x: (x != 'All', x)) + context['status_options'] = sorted(context['status_options'], key=lambda x: (x is not None, x != 'All', x if x is not None else '')) if outcome not in context['outcome_options']: context['outcome_options'].append(outcome) - context['outcome_options'] = sorted(context['outcome_options'], key=lambda x: (x is not None, x)) + context['outcome_options'] = sorted(context['outcome_options'],key=lambda x: (x is not None, x != 'All', x if x is not None else '')) queryStr = '' status_filter = self.request.GET.get('status') @@ -145,4 +145,4 @@ def _get_applicable_data_period(value): try: return datetime.strptime(str(value), '%Y%m').strftime('%b. %Y') except: - return None \ No newline at end of file + return None diff --git a/apcd_cms/src/apps/exception/templates/exception_submission_form/exception_threshold_form.html b/apcd_cms/src/apps/exception/templates/exception_submission_form/exception_threshold_form.html index 0cd4cdda..d26c7193 100644 --- a/apcd_cms/src/apps/exception/templates/exception_submission_form/exception_threshold_form.html +++ b/apcd_cms/src/apps/exception/templates/exception_submission_form/exception_threshold_form.html @@ -478,4 +478,4 @@