A model field to store a file size, whose edition and display shows units.
Project description
django-sizefield is a file size field, stored as BigInteger and rendered with units in Bytes (KB, MB, …)
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)
LICENSE
Lesser GNU Public License
CHANGELOG
0.5 (2014-06-18)
Fix template tag not support None values (fixes #4)
Support comma notation for float values (fixes #5)
0.4 (2013-08-25)
Complete refactor by @perez
0.3 (2013-06-08)
South support by @meteozond
0.2 (2013-05-31)
Petabytes support by @meteozond
0.1 (2011-01-04)
Initial working version.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-sizefield-0.5.zip
.
File metadata
- Download URL: django-sizefield-0.5.zip
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2896ad70af75aeae386a1f4dee27b742f5854bf2d2aabd383c80ca43fd6a4f91 |
|
MD5 | c17ae93ca282c7b1315ac11aa79be619 |
|
BLAKE2b-256 | 4a18b03edd7f54d37e2f79e3bebd57ece44f2f10657fa4eb23d8f8dd47d16759 |