Try to show existing filename, for upload widget

This commit is contained in:
Lance Edgar 2021-01-05 18:53:00 -06:00
parent e548b72323
commit fd1342c605

View file

@ -786,7 +786,10 @@ class Form(object):
the overall response, to be interpreted on the client side. the overall response, to be interpreted on the client side.
""" """
if isinstance(field.schema.typ, deform.FileData): if isinstance(field.schema.typ, deform.FileData):
# TODO: don't recall why "always null" here? # TODO: we used to always/only return 'null' here but hopefully
# this also works, to show existing filename when present
if field.cstruct and field.cstruct['filename']:
return json.dumps({'name': field.cstruct['filename']})
return 'null' return 'null'
if isinstance(field.schema.typ, colander.Set): if isinstance(field.schema.typ, colander.Set):