Skip to main content

A human-readable duration form field for Django

Project description

Expose a duration value to your staff and users in a non-hideous manner. Allows you to accept input such as “3 days and 2 minutes” or even “6years,32 min & 503ms”, and optionally renders values to the user in a similar manner.

Requirements

  • Django 1.8 (the first one with a duration field)

  • Python 2.7, 3.4, or PyPy (should work with 3.3, but I haven’t tested it)

Usage

Insert a NaturalDurationField into a form somewhere. The human_values kwarg tells whether to render initial values in a nice, humanized fashion (2 days and 30 minutes) or the usual django fashion (2 00:30:00). At no point is precision lost when resaved.

Other Notes

Copyright Jake Merdich, 2015, released under New BSD license.

Largely inspired by the [Juration](https://github.com/domchristie/juration) javascript library.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

django-natural-duration-0.1.tar.gz (5.5 kB view details)

Uploaded Source

File details

Details for the file django-natural-duration-0.1.tar.gz.

File metadata

File hashes

Hashes for django-natural-duration-0.1.tar.gz
Algorithm Hash digest
SHA256 0ba2c5463343d463de9d1608f892bd006dc5dbf57a73f018e75e4c036da96a85
MD5 552fed4762d35f2b521b3aa701f33834
BLAKE2b-256 86878dc41952027efa3cabd7bf7acc2ac9a2fe0f4cb9a959c4dbbf6a44b91954

See more details on using hashes here.

Supported by

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