django-sizefield is a file size field, stored as BigInteger and rendered with units in Bytes (KB, MB, ...)
pip install django-sizefield
class Data(models.Model): path = models.FilePathField() size = FileSizeField()
The model form will have a TextInput, which renders the value with units, and accepts values with or without units.
It adds units to any number value:
{% load sizefieldtags %} {{ value|filesize }}
will render 12.3KB (for example)
- Mathieu Leplatre <[email protected]>
- Alexander (@meteozond)
- Tom Yam (@perez)
- Lesser GNU Public License