Avoid crash when deleting drafts

This commit is contained in:
Carl van Tonder 2018-05-01 01:08:40 -04:00
parent 4dfbb61402
commit d84aa0f3b9

View File

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