python - How to add more than one location path to django FileSystemStorage backend? -
im trying create custom storage backend in django==1.6.8 make possible decide file passed filefield should saved in local storage depends on specified value other field. know can set location attribute of filesystemstorage when initialized, it's not works in situation, set same path instances. think custom storage https://docs.djangoproject.com/en/1.6/howto/custom-file-storage/# way this. paths should different, no subdirectory of media_root, different absolute paths.
can override filesystemstorage method:
def path(self, name): try: path = safe_join(self.location, name) except valueerror: raise suspiciousfileoperation("attempted access '%s' denied." % name) return os.path.normpath(path) ...somehow? idea? please help!
Comments
Post a Comment