From d84aa0f3b92c055ac8d577a9808af9249c693457 Mon Sep 17 00:00:00 2001 From: Carl van Tonder Date: Tue, 1 May 2018 01:08:40 -0400 Subject: [PATCH] Avoid crash when deleting drafts --- apps/map/views.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/map/views.py b/apps/map/views.py index 7d7f525..0f5741d 100644 --- a/apps/map/views.py +++ b/apps/map/views.py @@ -157,12 +157,15 @@ class Drafts(LoginRequiredMixin, View): for k in ['official_project_documents', 'other_documents', 'shapefiles']: - items = list(filter( - lambda x: ( - x['name'] == '{0}_files'.format(k) - and x['value'] != '' - ), data['data']['form'] - )) + try: + items = list(filter( + lambda x: ( + x['name'] == '{0}_files'.format(k) + and x['value'] != '' + ), data['data']['form'] + )) + except KeyError: + continue try: items = items[0]['value'].split(',')