Margie Roginski
unread,Nov 5, 2009, 6:53:09 PM11/5/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
In my app, my user inputs one more more attachments and on the server
side I am successfully getting them via code like this:
for file in request.FILES.getlist('attachment'):
a = Attachment(
filename = filename,
mime_type=mimetypes.guess_type(filename)[0] or
'application/octet-stream',
size=file.size,
)
In certain cases the user has errors in other parts of the form, and I
need to re-render the form. In this case I would like to re-fill the
inputs that they originally filled with the paths to their
attachments. IE, prior to submitting the form, they browsed to some
file and selected it as their attachment. When I re-render the form
after detecting an error, I would like them to not have to re-browse
to find their attachment again.
However, I do not see any way of getting the orignal path name from
the InMemoryUploadedFile that I have access to in my <file> variable.
Does anyone know if there is a way to get this original path?
Thanks!
Margie