ClearableFileInput doesn't render a currently value when invalid

386 views
Skip to first unread message

Hiroki Kiyohara

unread,
Nov 12, 2012, 6:31:54 AM11/12/12
to django-d...@googlegroups.com
Hi, all.

Problem
=======
In updating objects(UpdateView and so on), django.forms.widgets.ClearableFileInput doesn't render a currently value when the POSTed data was invalid(for example, uploading PDF file to ImageField using ClearableFileInput).
The HTML rendered when invalid error is only includes input tag. It's natural to render more components ("Currentry: /path/to/spam", clear checkbox and so on).

For more detail
----------------------
And the input field rendered when invalid error allows empty, even if the field is required. And it allows empty submit. In this case, the currently value will retain. This behavior is gross. seriously.

Why this happens
===============
render method on ClearableFileInput isn't render currently value and checkbox when value arg is empty.
When validation error is raise, the arg will be empty.

Django's version
==============
I found this behavior in Django==1.4.1

conclusion
=========
If you can't understand my poor English or this problem is my misunderstanding, sorry, please tell me so.

-----------------------
Hiroki Kiyohara
@hirokiky
http://hirokiky.org/

Tino de Bruijn

unread,
Nov 12, 2012, 11:33:48 AM11/12/12
to django-d...@googlegroups.com
Hi Hiroki,

It appears to me that this is the same issue as described in this ticket [1] and was referenced a few weeks ago on this mailinglist ([2]). Feel free to comment on that ticket if you have new insights or a patch.


Regards,


Tino 

Hiroki Kiyohara

unread,
Nov 12, 2012, 6:43:17 PM11/12/12
to django-d...@googlegroups.com
Hi, tino. Thanks for your reply.

I compleatly understood that the problem is known here.
If I fell like it, I try solving this.

Thank you.

hirokiky

Reply all
Reply to author
Forward
0 new messages