#1756 closed defect (fixed)
[patch] FilePathField gives no blank option in admin when blank=True is set
Reported by: | Adam Endicott | Owned by: | Adrian Holovaty |
---|---|---|---|
Component: | contrib.admin | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I have a model with this field:
image = models.FilePathField(path='/my/path', blank=True, null=True)
In the admin interface, the image field shows up dimmed like the rest
of the optional fields. However the select list lists all the files in
/my/path, without any blank option. So you are in effect forced to
select a file.
The patch adds models.BLANK_CHOICE_DASH to the choices list if is_required is false.
(django-users thread: http://groups.google.com/group/django-users/browse_frm/thread/9988c0119c95dda9/#)
Attachments (1)
Change History (3)
by , 19 years ago
Attachment: | patch.diff added |
---|
comment:1 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 18 years ago
This patch is unacceptable because the form layer shouldn't be importing from the database layer.
(In [3146]) Fixed #1756 -- Permit selecting no file in a FilePathField with blank = True.
Thanks to Adam Endicott for the patch.