Skip to content
A model field to store a file size, whose edition and display shows units (KB, MB, ...)
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
sizefield
.gitignore
.travis.yml
CHANGES
LICENSE
MANIFEST.in
README.rst
quicktest.py
setup.py

README.rst

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

https://travis-ci.org/leplatrem/django-sizefield.png 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
You can’t perform that action at this time.