Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
67d08d2bb9
@ -161,9 +161,11 @@ class Drafts(LoginRequiredMixin, View):
|
|||||||
data = json.loads(draft.data)
|
data = json.loads(draft.data)
|
||||||
|
|
||||||
for k in ['official_project_documents', 'other_documents',
|
for k in ['official_project_documents', 'other_documents',
|
||||||
'shapefiles']:
|
'shapefiles', 'images' ]:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# Filter the dictionary of form fields in the draft
|
||||||
|
# down to just the ones right the right name `k`
|
||||||
items = list(filter(
|
items = list(filter(
|
||||||
lambda x: (
|
lambda x: (
|
||||||
x['name'] == '{0}_files'.format(k)
|
x['name'] == '{0}_files'.format(k)
|
||||||
@ -173,11 +175,13 @@ class Drafts(LoginRequiredMixin, View):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Split the comma-separated list of IDs into a list
|
||||||
try:
|
try:
|
||||||
items = items[0]['value'].split(',')
|
items = items[0]['value'].split(',')
|
||||||
except IndexError:
|
except IndexError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Delete those items
|
||||||
for item in items:
|
for item in items:
|
||||||
try:
|
try:
|
||||||
f = File.objects.get(id=item)
|
f = File.objects.get(id=item)
|
||||||
|
Loading…
Reference in New Issue
Block a user