{ "info": { "author": "Tim Allen", "author_email": "tim@pyphilly.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 2.2", "Framework :: Django :: 3", "Framework :: Django :: 4", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "# Django Tempus Dominus\n\nDjango Tempus Dominus provides Django widgets for the [Tempus Dominus Bootstrap 4 DateTime](https://tempusdominus.github.io/bootstrap-4/ \"Tempus Dominus\") date and time picker.\n\n## A Note About the Future of This Package\n\nThe parent project to this package, Tempus Dominus, is being reworked. This package will not receive any feature updates until the parent project releases version 6, which will deprecate jQuery and Bootstrap as dependencies. When that occurs, we'll update this package to support v6.\n\n## Installation\n\n* From PyPI: `pip install django-tempus-dominus`\n\nThen add `tempus_dominus` to `INSTALLED_APPS` in your Django settings.\n\n## Usage & Django Settings\n\nThe following settings are available:\n\n* `TEMPUS_DOMINUS_LOCALIZE` (default: `False`): if `True`, widgets will be translated to the selected browser language and use the localized date and time formats.\n* `TEMPUS_DOMINUS_INCLUDE_ASSETS` (default: `True`): if `True`, loads Tempus Dominus and `moment` JS and CSS from Cloudflare's CDN, otherwise loading the JS and CSS are up to you.\n* `TEMPUS_DOMINUS_DATE_FORMAT` (default: `YYYY-MM-DD`)\n* `TEMPUS_DOMINUS_DATETIME_FORMAT` (default: `YYYY-MM-DD HH:mm:ss`)\n* `TEMPUS_DOMINUS_TIME_FORMAT` (default: `HH:mm:ss`)\n\nThree widgets are provided:\n\n* `DatePicker`\n * Defaults to `L` if `TEMPUS_DOMINUS_LOCALIZE` is `True`, otherwise `TEMPUS_DOMINUS_DATE_FORMAT`\n* `DateTimePicker`\n * Defaults to `L LTS` if `TEMPUS_DOMINUS_LOCALIZE` is `True`, otherwise `TEMPUS_DOMINUS_DATETIME_FORMAT`\n* `TimePicker`\n * Defaults to `LTS` if `TEMPUS_DOMINUS_LOCALIZE` is `True`, otherwise `TEMPUS_DOMINUS_TIME_FORMAT`\n\nIn your Django form, you can use the widgets like this:\n\n```python\nfrom django import forms\nfrom tempus_dominus.widgets import DatePicker, TimePicker, DateTimePicker\n\nclass MyForm(forms.Form):\n date_field = forms.DateField(widget=DatePicker())\n date_field_required_with_min_max_date = forms.DateField(\n required=True,\n widget=DatePicker(\n options={\n 'minDate': '2009-01-20',\n 'maxDate': '2017-01-20',\n },\n ),\n initial='2013-01-01',\n )\n \"\"\"\n In this example, the date portion of `defaultDate` is irrelevant;\n only the time portion is used. The reason for this is that it has\n to be passed in a valid MomentJS format. This will default the time\n to be 14:56:00 (or 2:56pm).\n \"\"\"\n time_field = forms.TimeField(\n widget=TimePicker(\n options={\n 'enabledHours': [9, 10, 11, 12, 13, 14, 15, 16],\n 'defaultDate': '1970-01-01T14:56:00'\n },\n attrs={\n 'input_toggle': True,\n 'input_group': False,\n },\n ),\n )\n datetime_field = forms.DateTimeField(\n widget=DateTimePicker(\n options={\n 'useCurrent': True,\n 'collapse': False,\n },\n attrs={\n 'append': 'fa fa-calendar',\n 'icon_toggle': True,\n }\n ),\n )\n```\n\nThen in your template, include jQuery, `{{ form.media }}`, and render the form:\n\n```HTML+Django\n\n
\n {# Include FontAwesome; required for icon display #}\n \n\n {# Include Bootstrap 4 and jQuery #}\n \n \n\n {# Django Tempus Dominus assets are included in `{{ form.media }}` #}\n {{ form.media }}\n \n\n \n