Re: [Django Code] #7048: Support clearing FileFields in the admin if blank=True

2 views
Skip to first unread message

Django Code

unread,
Jul 12, 2008, 5:27:25 AM7/12/08
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
--------------------------------------+-------------------------------------
Reporter: jarrow | Owner: uptimebox
Status: assigned | Milestone:
Component: Admin interface | Version: newforms-admin
Resolution: | Keywords: nfa-someday
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Changes (by uptimebox):

* owner: nobody => uptimebox
* status: new => assigned

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:3>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines

Django Code

unread,
Jul 13, 2008, 8:39:29 AM7/13/08
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
--------------------------------------+-------------------------------------
Reporter: jarrow | Owner: uptimebox
Status: assigned | Milestone:
Component: Admin interface | Version: newforms-admin
Resolution: | Keywords: nfa-someday yandex-sprint
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Changes (by isagalaev):

* keywords: nfa-someday => nfa-someday yandex-sprint

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:4>

Django Code

unread,
Jul 24, 2008, 6:13:59 AM7/24/08
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
--------------------------------------+-------------------------------------
Reporter: jarrow | Owner: uptimebox
Status: assigned | Milestone:
Component: Admin interface | Version: newforms-admin
Resolution: | Keywords: nfa-someday yandex-sprint
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Changes (by Jonas):

* cc: co...@vonposer.de (added)

Comment:

I'm very interested in a solution to this problem and would love to help
out. Let me know if I can do something.

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:5>

Django Code

unread,
Aug 12, 2008, 11:33:20 AM8/12/08
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
--------------------------------------+-------------------------------------
Reporter: jarrow | Owner: uptimebox
Status: assigned | Milestone: 1.0
Component: Admin interface | Version: SVN
Resolution: | Keywords: nfa-someday yandex-sprint
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Changes (by jacob):

* stage: Unreviewed => Accepted
* version: newforms-admin => SVN
* milestone: => 1.0

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:6>

Django Code

unread,
Aug 18, 2008, 10:27:06 AM8/18/08
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
--------------------------------------+-------------------------------------
Reporter: jarrow | Owner: uptimebox
Status: assigned | Milestone: 1.0
Component: Admin interface | Version: SVN
Resolution: | Keywords: nfa-someday yandex-sprint
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Changes (by DavidReynolds):

* cc: da...@reynoldsfamily.org.uk (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:7>

Django Code

unread,
Aug 18, 2008, 5:32:31 PM8/18/08
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
--------------------------------------+-------------------------------------
Reporter: jarrow | Owner: jarrow
Status: new | Milestone: 1.0
Component: Admin interface | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Changes (by jarrow):

* keywords: nfa-someday yandex-sprint =>
* owner: uptimebox => jarrow
* status: assigned => new

Comment:

Claiming the ticket as there hasn't been any activity in the last month.
If there exists a patch from the Yandex sprint now would be a good time to
post it :)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:8>

Django Code

unread,
Aug 18, 2008, 5:39:14 PM8/18/08
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
--------------------------------------+-------------------------------------
Reporter: jarrow | Owner: jarrow
Status: new | Milestone: 1.0
Component: Admin interface | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Comment (by isagalaev):

Looks like we didn't get to it after all. Feel free to take it, thanks!

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:9>

Django Code

unread,
Aug 18, 2008, 6:13:02 PM8/18/08
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
--------------------------------------+-------------------------------------
Reporter: jarrow | Owner: jarrow
Status: new | Milestone: 1.0
Component: Admin interface | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Comment (by garcia_marc):

I don't have a patch for it, but this feature is working in a field that
subclasses FileField on the stdimage application. So it should be easy to
extract from there, and create a patch. Probably the patch will need to be
improved later, but at least is a starting point.

stdimage is available at http://code.google.com/p/django-stdimage/

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:10>

Django Code

unread,
Aug 18, 2008, 6:27:16 PM8/18/08
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
--------------------------------------+-------------------------------------
Reporter: jarrow | Owner: jarrow
Status: new | Milestone: 1.0
Component: Admin interface | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Comment (by jarrow):

Cool, thx! I also got code from brosner. I will probably use both sources
to compile a patch :)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:11>

Django Code

unread,
Aug 22, 2008, 4:25:55 AM8/22/08
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
--------------------------------------+-------------------------------------
Reporter: jarrow | Owner: jarrow
Status: new | Milestone: 1.0
Component: Admin interface | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Changes (by jarrow):

* has_patch: 0 => 1
* needs_tests: 0 => 1

Comment:

After talking to brosner on #django-dev we decided to implement this on
the ModelForm level. The attached patch introduces file deletion
functionality for ModelForms which can be customized via its Meta class
(see attached docs).

Work still to be done:

* Check admin CSS
* at least for the RTL design this is bound to break
* what about inlines?
* Fix regression tests
* Write new tests ;)

Notes on the patch:

* I had to add some special admin CSS to align everything properly. That
can only be achieved with a fixed padding to the left ...
* For the DeletableFileField I started with a MultiValueField till i had
overwritten every piece of code in it ... now it just sublcasses Field.
The widget still subclasses MultiWidget though.
* The display of the current file moved from the admin to ModelForm. It
just doesn't make sense to provide a delete option if the presence of a
file isn't visible ;)

If I missed anything in this short description let me know. Please test
and tell me what breaks I'll keep the patch up to date :)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:12>

Django Code

unread,
Aug 22, 2008, 4:38:15 PM8/22/08
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
--------------------------------------+-------------------------------------
Reporter: jarrow | Owner: jarrow
Status: new | Milestone: 1.0
Component: Admin interface | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Changes (by msaelices):

* cc: msae...@yaco.es (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:13>

Django Code

unread,
Aug 22, 2008, 10:02:05 PM8/22/08
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
--------------------------------------+-------------------------------------
Reporter: jarrow | Owner: jarrow
Status: new | Milestone: post-1.0
Component: Admin interface | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Changes (by brosner):

* milestone: 1.0 => post-1.0

Comment:

After seeing what is really involved in this ticket. jarrow and I decided
it is best to avoid this pre-1.0. There is just too much design decisions
that need to be made to make this work the right way. I personally
appreciate jarrow's work. This will certainly make it post-1.0. :)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:14>

Django Code

unread,
Aug 23, 2008, 7:53:28 PM8/23/08
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
--------------------------------------+-------------------------------------
Reporter: jarrow | Owner: jarrow
Status: new | Milestone: post-1.0
Component: Admin interface | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Comment (by jarrow):

Just a note to myself: Maybe the CSS could be shorter as I introduced
<br/>s after writing the style rules. Haven't checked though. The <br/>s
are there for a sensible default display without CSS when using for
example as_table().

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:15>

Django

unread,
Sep 24, 2008, 4:32:27 PM9/24/08
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: jarrow
Status: new | Milestone: post-1.0
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Comment (by jarrow):

#6405 is about making MultiValueField pass through initial data. Maybe
this could be closed if a deletable FileField is the only use case.

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:16>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 31, 2008, 8:23:51 PM10/31/08
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: jarrow
Status: new | Milestone: post-1.0
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by tahooie):

* cc: tah...@gmail.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:17>

Django

unread,
Nov 10, 2008, 6:00:27 PM11/10/08
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: jarrow
Status: new | Milestone: post-1.0
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Comment (by jarrow):

The attached patch seems to work fine. The tests still need fixing though.
I wanted to wait for some feedback on the code and approach :) RTL CSS
also not done yet. But there seems to be an admin redesign forthcoming
anyway.

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:18>

Django

unread,
Nov 12, 2008, 10:43:08 AM11/12/08
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: jarrow
Status: new | Milestone: post-1.0
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Comment (by jarrow):

With the current default values for the ModelForm Meta class options the
admin shows the delete checkbox and removes the file from disk. It does
not remove empty directories. To enable this in the admin one currently
needs to do something like this:

{{{
#!python
class TestModelAdmin(admin.ModelAdmin):
def get_form(self, request, obj=None, **kwargs):
defaults = {
"files_delete_empty_dirs": True,
}
defaults.update(kwargs)
return super(TestModelAdmin, self).get_form(request, obj,
**defaults)
}}}

Maybe a settings option to make deletion of empty dirs the default would
be nice. Or we could add a files_delete_empty_dirs option to the
ModelAdmin class and pass it to the ModelForm (like we do with exclude
etc.).

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:19>

Django

unread,
Nov 17, 2008, 10:54:58 PM11/17/08
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: jarrow
Status: new | Milestone: post-1.0
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by digitaljhelms):

* cc: digita...@gmail.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:20>

Django

unread,
Dec 8, 2008, 9:05:24 AM12/8/08
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: jarrow
Status: new | Milestone: post-1.0
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by andybak):

* cc: an...@andybak.net (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:21>

Django

unread,
Jan 19, 2009, 8:17:52 AM1/19/09
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: jarrow
Status: new | Milestone: post-1.0
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by anonymous):

* cc: ta...@taijala.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:22>

Django

unread,
Jan 19, 2009, 9:54:56 AM1/19/09
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone: post-1.0
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by brosner):

* owner: jarrow => brosner
* status: new => assigned

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:23>

Django

unread,
Jan 30, 2009, 9:45:32 AM1/30/09
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields in the admin if blank=True
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone: post-1.0
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by anonymous):

* cc: flo...@gmail.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:24>

Django

unread,
Feb 18, 2009, 6:08:42 PM2/18/09
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone: post-1.0
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by kmtracey):

* summary: Support clearing FileFields in the admin if blank=True =>
Support clearing FileFields with ModelForms

Comment:

Updated summary to reflect scope of the ticket -- discussion and patch
indicate the solution here will not be admin-specific.

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:25>

Django

unread,
Feb 18, 2009, 6:13:07 PM2/18/09
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone: post-1.0
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Comment (by kmtracey):

(Oh and forgot to mention assuming the wider scope, #10299 has been closed
as a dupe.)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:26>

Django

unread,
Feb 20, 2009, 4:37:57 PM2/20/09
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone: post-1.0
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by Valera_Grishin):

* cc: valera....@gmail.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:27>

Django

unread,
Mar 3, 2009, 5:48:07 AM3/3/09
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone:
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by liangent):

* cc: lian...@gmail.com (added)

Comment:

a problem...

if I created a subclass of ModelForm, then added some FileField(s) which
are not in the Model, the latest patch will raise {{{ FieldDoesNotExist:
Xxx has no field named 'xxx' }}}.

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:29>

Django

unread,
Mar 31, 2009, 9:22:29 AM3/31/09
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone: 1.1
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by mrts):

* milestone: => 1.1

Comment:

Seems to be in scope for 1.1 according to [wiki:Version1.1Features].

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:30>

Django

unread,
Apr 9, 2009, 11:15:13 AM4/9/09
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone: 1.1
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Comment (by jacob):

It looks like this patch metastasized and grew some unrelated features --
to wit, nothing about this ticket has anything to do with deleting files
(?) and directories (!) as a side-effect of clearing a file field. That's
a separate discussion that we haven't had yet, and we're certainly not
sneaking in new behavior like that this late in the release cycle.

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:31>

Django

unread,
Apr 9, 2009, 11:56:56 AM4/9/09
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone: 1.1
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Comment (by jarrow):

The deletion of files from disk was already in the code that Brian gave
me. So I thought that it was in scope for the ticket. I also wouldn't call
the deletion of files and directories unrelated. I would expect the admin
to be able to get rid of uploaded files if it has the option to clear the
field. But we could of course disable this by default. Sure the delete
directories feature sounds scary, that's why it is off by default.

Brian wanted to review the ticket. I hope he finds the time to have a look
at this (he seems to be rather busy at the moment ...).

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:32>

Django

unread,
Apr 12, 2009, 8:59:35 PM4/12/09
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone: 1.1
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Comment (by Alex):

I'd like to suggest, in the strongest terms possible, that this shouldn't
be a Meta option, it should be an option on the Field. Meta is for
formwide options.

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:33>

Django

unread,
Apr 15, 2009, 1:10:07 PM4/15/09
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone: 1.2
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by Alex):

* milestone: 1.1 => 1.2

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:34>

Django

unread,
Jun 9, 2009, 3:54:41 AM6/9/09
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone: 1.2
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by anonymous):

* cc: nicola...@gmail.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:35>

Django

unread,
Jul 12, 2009, 2:14:06 AM7/12/09
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone: 1.2
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by anonymous):

* cc: anb...@gmail.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:36>

Django

unread,
Sep 10, 2009, 6:28:27 PM9/10/09
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone: 1.2
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by anonymous):

* cc: jdu...@gmail.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:38>

Django

unread,
Sep 15, 2009, 10:44:37 PM9/15/09
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone: 1.2
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by DrMeers):

* cc: drm...@gmail.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:39>

Django

unread,
Oct 31, 2009, 12:39:52 AM10/31/09
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone: 1.2
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by anonymous):

* cc: sebl...@gmail.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:40>

Django

unread,
Nov 14, 2009, 8:07:10 AM11/14/09
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone: 1.2
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by kahless):

* cc: herber...@gmail.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:41>

Django

unread,
Jan 12, 2010, 7:56:06 AM1/12/10
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone: 1.2
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by gogna):

* cc: flavio....@gmail.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:42>

Django

unread,
Feb 20, 2010, 4:52:21 AM2/20/10
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone: 1.2
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by tolano):

* cc: ari...@gmail.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:43>

Django

unread,
Feb 23, 2010, 6:59:24 PM2/23/10
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone:
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by ubernostrum):

* milestone: 1.2 =>

Comment:

1.2 is feature-frozen, moving this feature request off the milestone.

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:44>

Django

unread,
May 24, 2010, 6:07:18 AM5/24/10
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone:
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by danfairs):

* cc: dan....@gmail.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:45>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To post to this group, send email to django-...@googlegroups.com.
To unsubscribe from this group, send email to django-update...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.

Django

unread,
Jun 1, 2010, 3:16:40 PM6/1/10
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: brosner
Status: assigned | Milestone:
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by trent):

* cc: tjur...@gmail.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:46>

Django

unread,
Sep 10, 2010, 7:46:12 PM9/10/10
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------------------+--------------------------------
Reporter: jarrow | Owner: carljm
Status: new | Milestone:
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by carljm):

* owner: brosner => carljm
* status: assigned => new

Comment:

Picking this up at the sprints. Going to rework the patch to remove file-
deletion entirely (that can be a separate ticket/discussion) and keep
things out of the form Meta per Alex's comment.

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:47>

Django

unread,
Sep 10, 2010, 7:56:37 PM9/10/10
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------+--------------------------------------------
Reporter: jarrow | Owner: carljm
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------+--------------------------------------------
Changes (by carljm):

* component: django.contrib.admin => Forms

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:48>

Django

unread,
Sep 11, 2010, 9:58:42 PM9/11/10
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------+--------------------------------------------
Reporter: jarrow | Owner: carljm
Status: new | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
-------------------------------+--------------------------------------------
Comment (by carljm):

Added a new patch with these design choices:

* No file deleting.
* Clearability should be the default behavior of a
forms.FileField(required=False) - and thus also
models.FileField(blank=True).formfield(). It's a bug that FileFields are
currently not clearable. Thus, no Meta options or extra field arguments
are needed.
* This involves a minor backwards incompatibility in form rendering (a
possible checkbox where there was not one previously), which is documented
in the 1.3 release notes.
* It doesn't make sense to have a clearable file input that doesn't
display the current value of the field, so that behavior is moved from
AdminFileWidget to ClearableFileInput (which AdminFileWidget inherits).
* The HTML rendering of the ClearableFileInput is customizable by
subclassing and overriding some class attributes.
* Contradictory input (checking the clear checkbox and simultaneously
uploading a new file) results in a form validation error.

All of these design choices were checked in person with at least one core
committer at the sprint, mostly with Malcolm.

For reviewers more comfortable with git, here is the github compare URL
for my working branch for this patch:
http://github.com/carljm/django/compare/master...ticket_7048

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:49>

Django

unread,
Sep 12, 2010, 4:45:41 AM9/12/10
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------+--------------------------------------------
Reporter: jarrow | Owner: carljm
Status: assigned | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
-------------------------------+--------------------------------------------
Changes (by carljm):

* status: new => assigned
* needs_tests: 1 => 0

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:50>

Django

unread,
Sep 12, 2010, 6:59:35 AM9/12/10
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------+--------------------------------------------
Reporter: jarrow | Owner: carljm
Status: assigned | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: sprintSep2010
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
-------------------------------+--------------------------------------------
Changes (by carljm):

* keywords: => sprintSep2010

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:51>

Django

unread,
Sep 28, 2010, 12:07:59 PM9/28/10
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------+--------------------------------------------
Reporter: jarrow | Owner: carljm
Status: assigned | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: sprintSep2010
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
-------------------------------+--------------------------------------------
Changes (by Althalus):

* cc: mort...@gmail.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:52>

Django

unread,
Sep 30, 2010, 3:09:58 PM9/30/10
to djang...@holovaty.com, django-...@googlegroups.com
#7048: Support clearing FileFields with ModelForms
-------------------------------+--------------------------------------------
Reporter: jarrow | Owner: carljm
Status: assigned | Milestone:
Component: Forms | Version: SVN
Resolution: | Keywords: sprintSep2010
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
-------------------------------+--------------------------------------------
Changes (by btubbs):

* cc: brent...@gmail.com (added)

--
Ticket URL: <http://code.djangoproject.com/ticket/7048#comment:53>
Reply all
Reply to author
Forward
0 new messages