Skip to main content
django-humanize − use humanize 3rd-party lib as template filters
================================================================

Django already offers
[django.contrib.humanize](https://docs.djangoproject.com/en/1.8/ref/contrib/humanize/)
but that implementation is lacking some features, like humanization of
durations.

That lib comes to the rescue allowing you to use *template filters*
backed on [the standalone humanize lib](https://pypi.python.org/pypi/humanize).

Install
------

Add `django_humanize` to your *INSTALLED_APPS* setting.

Examples
--------

### Template

{% load humanizelib %}

It lasted {{ duration|naturaldelta }}.

### View

import datetime
from django.shortcuts import render_

def summary(request):
context = {'duration': datetime.timedelta(seconds=1000)}
return render('template.html', context)

Will render as *"lasted 16 minutes."*.

Template filters
----------------

The following template filters are available :

- naturalday
- naturaltime
- ordinal
- intword
- naturaldelta
- intcomma
- apnumber
- fractional
- naturalsize
- naturaldate

Internationalization
---------------------

Internationalization is supported and matches Django *LANGUAGE_CODE* setting. If
it does not work, maybe, your language code is not supported by the standalone
humanize lib. Think about
[contributing it](https://github.com/jmoiron/humanize/#localization).

Metadata

Release files for django-humanize 0.1.2

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-humanize 0.1.2
File Size Uploaded Provenance Actions
django-humanize-0.1.2.tar.gz 2.3 kB Without provenance Details for django-humanize-0.1.2.tar.gz

Release files / django-humanize-0.1.2.tar.gz

Download URL django-humanize-0.1.2.tar.gz
Size 2.3 kB
Tags Source
SHA-256 checksum
How to use checksums
32491bf0209b89a277f7bfdab7fd6d4cc7944bb037f742d62e8e447a575c0028
BLAKE2b-256 checksum
How to use checksums
b3a8955344ecd167d6c8677fba60833fb4374e7e969d42af0e14029341e6ffc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-humanize 0.1.2

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.

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file No provenance

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