Bootstrap3/Bootstrap4/Bootstrap5 DatePickerInput, TimePickerInput, DateTimePickerInput, MonthPickerInput, YearPickerInput
Project description
This django widget contains Bootstrap 3, Bootstrap 4 and Bootstrap 5 Date-Picker, Time-Picker, DateTime-Picker, Month-Picker and Year-Picker input with date-range-picker functionality for django version >= 2.0. The widget implements bootstrap-datetimepicker v4 to show bootstrap-datepicker in django model forms and custom forms which can be configured easily for date-range selection.
If you are not using Bootstrap use django-flatpickr instead.
Demo
Getting Started
Follow the Getting Started doc.
Head over to Usage section to see how to use it in forms and views.
Read detailed Documentation on ReadTheDocs
Looks complex to get started? Follow a Quick Walkthrough Tutorial
Getting errors? See Troubleshoot instructions
Usage
Usage in Generic View
# File: views.py
from bootstrap_datepicker_plus.widgets import DateTimePickerInput
from django.views import generic
from .models import Question
class CreateView(generic.edit.CreateView):
model = Question
fields = ["question_text", "pub_date"]
def get_form(self):
form = super().get_form()
form.fields["pub_date"].widget = DateTimePickerInput()
return form
Advanced Usage
Types of DatePickers
The widget contains all types of date-picker you may ever need.
# File: forms.py
from bootstrap_datepicker_plus.widgets import DatePickerInput, TimePickerInput, DateTimePickerInput, MonthPickerInput, YearPickerInput
from django import forms
class EventForm(forms.ModelForm):
class Meta:
model = Event
fields = ["start_date", "start_time", "start_datetime", "start_month", "start_year"]
widgets = {
"start_date": DatePickerInput(),
"start_time": TimePickerInput(),
"start_datetime": DateTimePickerInput(),
"start_month": MonthPickerInput(),
"start_year": YearPickerInput(),
}
Implement date-range-picker
DatePickers can be linked to select a date-range or time-range.
# File: forms.py
from bootstrap_datepicker_plus.widgets import DatePickerInput, TimePickerInput
from django import forms
class EventForm(forms.ModelForm):
class Meta:
model = Event
fields = ["name", "start_date", "end_date", "start_time", "end_time"]
widgets = {
"start_date": DatePickerInput(),
"end_date": DatePickerInput(range_from="start_date"),
"start_time": TimePickerInput(),
"end_time": TimePickerInput(range_from="start_time"),
}
Customization
Contributing
License
This project is licensed under MIT LICENSE file for details.
Acknowledgments
This project implements Eonasdan/bootstrap-datetimepicker to display date-pickers. The project was initially forked from pbucher/django-bootstrap-datepicker and later reworked completely under MIT Licence.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_bootstrap_datepicker_plus-6.0.0.tar.gz.
File metadata
- Download URL: django_bootstrap_datepicker_plus-6.0.0.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7859e81edb660615e54eaf76cd50483c25cac3692e4c61f0b7771c271e0730ff
|
|
| MD5 |
c1e763d5462f4f5c1a11264de622fc24
|
|
| BLAKE2b-256 |
5155dc67f7772754eb0ffaf6b486288fa499a9331fd28a13f9aa638b85355ff3
|
Provenance
The following attestation bundles were made for django_bootstrap_datepicker_plus-6.0.0.tar.gz:
Publisher:
deploy.yml on monim67/django-bootstrap-datepicker-plus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_bootstrap_datepicker_plus-6.0.0.tar.gz -
Subject digest:
7859e81edb660615e54eaf76cd50483c25cac3692e4c61f0b7771c271e0730ff - Sigstore transparency entry: 947078891
- Sigstore integration time:
-
Permalink:
monim67/django-bootstrap-datepicker-plus@9739ecc08a529951830f84d9753749ac0e3d6332 -
Branch / Tag:
refs/tags/6.0.0 - Owner: https://github.com/monim67
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@9739ecc08a529951830f84d9753749ac0e3d6332 -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_bootstrap_datepicker_plus-6.0.0-py3-none-any.whl.
File metadata
- Download URL: django_bootstrap_datepicker_plus-6.0.0-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e5e26c70fb98472b1408d2ddc406c0f9b06980d9e34d806fb351908b72e70cf
|
|
| MD5 |
efbe2881867d517c5e2e7671ae9e09c9
|
|
| BLAKE2b-256 |
ce32dcf274f6f24283037a5b61cbf4c9b701d027b0a1f20dc755ad1cf1ae39ed
|
Provenance
The following attestation bundles were made for django_bootstrap_datepicker_plus-6.0.0-py3-none-any.whl:
Publisher:
deploy.yml on monim67/django-bootstrap-datepicker-plus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_bootstrap_datepicker_plus-6.0.0-py3-none-any.whl -
Subject digest:
9e5e26c70fb98472b1408d2ddc406c0f9b06980d9e34d806fb351908b72e70cf - Sigstore transparency entry: 947078893
- Sigstore integration time:
-
Permalink:
monim67/django-bootstrap-datepicker-plus@9739ecc08a529951830f84d9753749ac0e3d6332 -
Branch / Tag:
refs/tags/6.0.0 - Owner: https://github.com/monim67
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@9739ecc08a529951830f84d9753749ac0e3d6332 -
Trigger Event:
release
-
Statement type: