Skip to main content

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, …)

https://travis-ci.org/makinacorpus/django-sizefield.png https://coveralls.io/repos/makinacorpus/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

CHANGELOG

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-sizefield-0.4.zip (11.9 kB view details)

Uploaded Source

File details

Details for the file django-sizefield-0.4.zip.

File metadata

  • Download URL: django-sizefield-0.4.zip
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-sizefield-0.4.zip
Algorithm Hash digest
SHA256 b7d176c8c6f1c1239ad0268830aa6f201a292d0543f9dcf69ab60ffb6a289684
MD5 59f67aa3839e07997e04ab744b748d8d
BLAKE2b-256 bb9abac7dc463535bf091147159a16ac074e6bacb7401bd2ebf813568929c01b

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page