[patch] Added web_path option to FilePathField
|Reported by:||scum||Owned by:||adrian|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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.
icon = models.FilePathField(path="/Users/scum/Sites/testsite/templates/media/img/icons/", match=".+.[gif|jpg]", recursive=True, web_path="/images/icons")
will be saved as '/img/icons/icon1.gif' in the database
will be saved as '/img/icons/directoryName/icon2.gif' in the database