Ian Clelland and I have been working on a way to address the problem
that Django FileFields and ImageFields can't be cleared once they've
been set. We've posted a proposed solution here [1].
Our solution differs from the one proposed in Ticket #22 [2] in that
it's somewhat simpler, isn't restricted to admin, works within the
existing FormWrapper framework, and is compatible with post-MR code.
It currently subclasses FileField and works as a drop-in replacement,
but we hope that eventually the core FileField code could be changed
to include this functionality.
Ultimately, we'd like to submit this as a patch to Django's FileField,
but would like to get some feedback from the community before we move
further. Comments please :)
Bryan
[1] http://www.verdjn.com/wiki/FileField
[2] http://code.djangoproject.com/ticket/22
This is certainly a long-standing wart in Django, and on first glance
I like this solution a little better than the patch on #22, but we
also have a Summer of Code student working on major enhancements to
the admin's media support[1]; since there are only a couple weeks left
to go in SoC, I'd advise holding off on comitting any solution until
we see his final results.
[1]http://code.google.com/soc/django/appinfo.html?csaid=D7C2A8570706A6F6
--
"May the forces of evil become confused on the way to your house."
-- George Carlin
Thanks, James -- I hadn't realised that one of the SoC coders was
working around FileField and ImageField.
The code that we have now was written as a workaround for the problem,
rather than as a patch against django source, for just this reason. We
don't want to tread on anyone else's work if we can help it -- it just
makes for bigger maintenance headaches for us ;)
Unfortunately, (for us, possibly,) with further testing, we've
discovered a couple of problems with Django's handling of FileFields
and ImageFields -- not strictly limited to admin, but in the way that
fields tagged "core=True" are handled by manipulators. Because of
this, I've created a ticket (#2534) with a patch that fixes the core
field handling, and makes FileFields deletable.
http://code.djangoproject.com/ticket/2534
Regards,
Ian Clelland
<clel...@gmail.com>