Proposed solution to deleting contents of FileField

12 views
Skip to first unread message

Bryan Chow

unread,
Aug 9, 2006, 10:55:12 PM8/9/06
to django-d...@googlegroups.com
Hi All,

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

James Bennett

unread,
Aug 9, 2006, 11:22:09 PM8/9/06
to django-d...@googlegroups.com
On 8/9/06, Bryan Chow <br...@verdjn.com> wrote:
> 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].

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

Ian Clelland

unread,
Aug 12, 2006, 1:48:32 PM8/12/06
to django-d...@googlegroups.com
On 8/9/06, James Bennett <ubern...@gmail.com> wrote:
> 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.

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>

Reply all
Reply to author
Forward
0 new messages