how to get the file size of a video which is in file system using filesizeformat of django?
`{{ db.vid|filesizeformat }}`
returns only the size of the path.
how to get the file size of a video which is in file system using filesizeformat of django?
`{{ db.vid|filesizeformat }}`
returns only the size of the path.
If vid
is a FieldField
then try this:
{{ db.vid.file.size|filesizeformat }}
filesizeformat as it's name states (and as the official documentation describes) is formatting a file size value and not displaying the filesize itself. If you used the build in File Field for uploading the video, then you can use the already provided .size attribute.
{{db.vid.file.size}}
More information: https://docs.djangoproject.com/en/1.7/ref/files/file/#django.core.files.File.size And: https://docs.djangoproject.com/en/1.7/ref/templates/builtins/#filesizeformat