Example #1
0
 def _helper(name, filetype):
     return {
         'filepath': os.path.join(self.path, name),
         'filetype': filetype,
         'filename': name,
         'filedate': STORAGE.get_modified_time(os.path.join(self.path, name)),
         'filesize': sizeof_fmt(STORAGE.size(os.path.join(self.path, name))),
         'fileurl' : os.path.join(settings.MEDIA_URL, self.abspath, name),
     }
Example #2
0
 def file_details(self):
     filename = self.path.rsplit('/', 1)[-1]
     return {
         'directory': os.path.dirname(self.path),
         'filepath': self.path,
         'filename': filename,
         'filesize': sizeof_fmt(STORAGE.size(self.location)),
         'filedate': STORAGE.get_modified_time(self.location),
         'fileurl': self.url,
     }