Skip to main content

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

https://github.com/leplatrem/django-sizefield/actions/workflows/tests.yml/badge.svg 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

CHANGELOG

2.1.0 (2023-06-29)

  • Remove usage of removed functions in Django 4 (thanks @hagbarddenstore)

2.0.0 (2020-08-13)

  • Dropped support for python 2

  • Dropped support for Django <2

  • Moved testing to GitHub Actions and tox

1.0.1 (unreleased)

  • Nothing changed yet.

1.0.0 (2019-06-21)

  • Fix support of Django 1.11/2

0.9.1 (2016-04-13)

  • Fix lazy loading of translation infrastructure (#15, thanks @cemiarni).

0.9 (2015-11-12)

  • Add support for unitless values (#13, thanks @megapctr)

0.8 (2015-10-04)

  • Add support for Python3 (thanks @naxube)

0.7 (2015-03-13)

  • Add Zetta and Yotta support (thanks @meteozond)

  • Fix bug with big values (fixes #8, thanks @meteozond)

0.6 (2014-09-25)

  • Add Exabytes support (thanks Matt Pritchard)

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.

Metadata

Release files for django-sizefield 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-sizefield 2.1.0
File Size Uploaded Provenance Actions
django-sizefield-2.1.0.tar.gz 7.8 kB Without provenance Details for django-sizefield-2.1.0.tar.gz

Release files / django-sizefield-2.1.0.tar.gz

Download URL django-sizefield-2.1.0.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
02b119dc72f68466af2c9a3011fdb54b523925409c28de7461d1b3e10c6fa4f0
BLAKE2b-256 checksum
How to use checksums
e6f0c36b08e1f872449075963b370e70d5c4d4ecaf22fbd06c8424965a562d6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.16

Security for django-sizefield 2.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page