Django Duration Widget
When to use?
You can find duration field as below which is not far good for humans to use.
Django duration widget is used for simplfiend Django model's Duration field.
Quick start
-
Install
django-durationwidgetusingpippip install django-durationwidget -
Add
durationwidgetto yourINSTALLED_APPSsetting like this::INSTALLED_APPS = [ ... 'durationwidget', ]
-
Make sure to set
APP_DIRStoTruein settings.pyTEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [ os.path.join(BASE_DIR, 'templates'), ... ], 'APP_DIRS': True, # Setup this to True 'OPTIONS': { ... }, }, ]
-
Cheer up you are ready to use
TimeDurationWidgetas normal widget as below.from django import forms from durationwidget.widgets import TimeDurationWidget from .models import YourModel class CustomForm(forms.ModelForm): ... duration = forms.DurationField(widget=TimeDurationWidget(), required=False) class Meta: model = YourModel ...
It will render Duration field as below
TimeDurationWidget
duration = forms.DurationField(widget=TimeDurationWidget(
show_days=True, show_hours=True, show_minutes=True, show_seconds=True
), required=False)
Following keyword argument can be passed to show/ hide fields in duration widget.
By default all keyword arguments are set to
True
show_days : To display/ hide days field in widget
show_hours : To display/ hide hours field in widget
show_minutes : To display/ hide minutes field in widget
show_seconds : To display/ hide seconds field in widget
Metadata
Release files for django-durationwidget 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django-durationwidget-1.0.5.tar.gz | 71.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_durationwidget-1.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 77.2 kB
Release files / django-durationwidget-1.0.5.tar.gz
| Download URL | django-durationwidget-1.0.5.tar.gz |
|---|---|
| Size | 71.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a77bba14c173cbfe50071ae08759ca37218acb8567639687b0119647cb78c53f
|
|
BLAKE2b-256 checksum How to use checksums |
117a12e987f4b7ea57fb3d66997984b6863af45fd5fb326bfea47904aa27a607
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.6
|
Release files / django_durationwidget-1.0.5-py3-none-any.whl
| Download URL | django_durationwidget-1.0.5-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d14d5dfcf46c444fb203fe911cd058f78ba482c81ea2f0665db08369a1eff47
|
|
BLAKE2b-256 checksum How to use checksums |
18798e693a38b28adf374d90d4ecc6221f0a93d08442b57e699fde070c6b7780
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.6
|
Security for django-durationwidget 1.0.5
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.