Skip to content

Latest commit

 

History

History
71 lines (39 loc) · 1.11 KB

README.rst

File metadata and controls

71 lines (39 loc) · 1.11 KB

django-sizefield is a file size field, stored as BigInteger and rendered with units in Bytes (KB, MB, ...)

https://coveralls.io/repos/leplatrem/django-sizefield/badge.png

INSTALL

pip install django-sizefield

USAGE

Model field

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.

Template filter

It adds units to any number value:

{% load sizefieldtags %}

{{ value|filesize }}

will render 12.3KB (for example)

AUTHORS

LICENSE

  • Lesser GNU Public License