Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#2598 closed enhancement (wontfix)

[patch] Added web_path option to FilePathField

Reported by: scum Owned by: Adrian Holovaty
Component: contrib.admin Version:
Severity: normal Keywords: FilePathField
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 understand that you need the full path in order to scan the directory for files but saving the full path information to the database seems completely worthless. When I am using an object with a filepath field, I need access to the web relative path, not the file system relative path. What is needed is a web_path variable. This optional keyword will remove the regular path and replace it with the web_path.

Usage:
icon = models.FilePathField(path="/Users/scum/Sites/testsite/templates/media/img/icons/", match=".+.[gif|jpg]", recursive=True, web_path="/images/icons")

Examples:
/Users/scum/Sites/testsite/templates/media/images/icons/icon1.gif
will be saved as '/img/icons/icon1.gif' in the database

/Users/scum/Sites/testsite/templates/media/images/icons/directoryName/icon2.gif
will be saved as '/img/icons/directoryName/icon2.gif' in the database

Attachments (1)

FilePathFieldEnhancement.diff (2.8 KB ) - added by scum 18 years ago.
[patch] FilePathField web_path enhancement

Download all attachments as: .zip

Change History (3)

by scum, 18 years ago

[patch] FilePathField web_path enhancement

comment:1 by anonymous, 18 years ago

Resolution: wontfix
Status: newclosed

We don't want to jumble up filesystem paths and URLs -- which is what you are calling a web_path -- like that. FileField and its derivatives store the path to the file in the filesystem. Mapping that to a URL is done using methods like get_FOO_url().

comment:2 by Malcolm Tredinnick, 18 years ago

Sorry, that resolution decision was made by me. Was accidently not logged in.

Note: See TracTickets for help on using tickets.
Back to Top