Skip to content

Commit c8235bc

Browse files
committed
Add Bootstrap 5 support
1 parent 1dd5828 commit c8235bc

File tree

10 files changed

+29
-28
lines changed

10 files changed

+29
-28
lines changed

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
django-bootstrap-datepicker-plus
33
########################################
44

5-
This django widget contains Bootstrap 3 and Bootstrap 4
5+
This django widget contains Bootstrap 3, Bootstrap 4 and Bootstrap 5
66
Date-Picker, Time-Picker, DateTime-Picker, Month-Picker and Year-Picker input
7-
with date-range-picker functionality for django version 2.1, 2.0, 1.11, 1.10 and 1.8.
7+
with date-range-picker functionality for django version >= 1.8.
88
The widget implements `bootstrap-datetimepicker v4 <http://eonasdan.github.io/bootstrap-datetimepicker/>`_
99
to show bootstrap-datepicker in django model forms and custom forms
1010
which can be configured easily for date-range selection.

bootstrap_datepicker_plus/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ def _make_version(major, minor, micro, releaselevel, serial):
88
return version
99

1010

11-
version_info = (3, 0, 5, "final", 0)
11+
version_info = (3, 0, 6, "final", 0)
1212
__version__ = _make_version(*version_info)

bootstrap_datepicker_plus/static/bootstrap_datepicker_plus/js/datepicker-widget.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
factory(jQuery)
88
}(function ($) {
99
var datepickerDict = {};
10-
var isBootstrap4 = $.fn.collapse.Constructor.VERSION.split('.').shift() === "4";
11-
var isBootstrap5 = $.fn.collapse.Constructor.VERSION.split('.').shift() == "5";
10+
const bootstrapVersion = (window.bootstrap?.Collapse||$.fn.collapse.Constructor).VERSION;
11+
var isBootstrap4 = bootstrapVersion.split('.').shift() === "4";
12+
var isBootstrap5 = bootstrapVersion.split('.').shift() === "5";
1213
function fixMonthEndDate(e, picker) {
1314
e.date && picker.val().length && picker.val(e.date.endOf('month').format('YYYY-MM-DD'));
1415
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="input-group date">
2-
{% include "bootstrap_datepicker_plus/input.html" %}
3-
<div class="input-group-addon input-group-append" data-target="#datetimepicker1" data-toggle="datetimepickerv">
4-
<div class="input-group-text"><i class="glyphicon glyphicon-calendar"></i></div>
5-
</div>
2+
{% include "bootstrap_datepicker_plus/input.html" %}
3+
<div class="input-group-addon input-group-append input-group-text">
4+
<i class="glyphicon glyphicon-calendar"></i>
5+
</div>
66
</div>
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="input-group date">
2-
{% include "bootstrap_datepicker_plus/input.html" %}
3-
<div class="input-group-addon input-group-append" data-target="#datetimepicker1" data-toggle="datetimepickerv">
4-
<div class="input-group-text"><i class="glyphicon glyphicon-time"></i></div>
5-
</div>
2+
{% include "bootstrap_datepicker_plus/input.html" %}
3+
<div class="input-group-addon input-group-append input-group-text">
4+
<i class="glyphicon glyphicon-time"></i>
5+
</div>
66
</div>

docs/Template_Customizing.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The calendar is not yet available for customizing, but the input field template
99
.. code:: python
1010
1111
# File: forms.py
12-
from bootstrap_datepicker_plus import DatePickerInput
12+
from bootstrap_datepicker_plus.widgets import DatePickerInput
1313
from django import forms
1414
1515
class MyDatePickerInput(DatePickerInput):

docs/Usage.rst

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Usage in Generic View
1111
:emphasize-lines: 2,11
1212
1313
# File: views.py
14-
from bootstrap_datepicker_plus import DateTimePickerInput
14+
from bootstrap_datepicker_plus.widgets import DateTimePickerInput
1515
from django.views import generic
1616
from .models import Question
1717
@@ -32,7 +32,7 @@ Custom Form usage
3232
:emphasize-lines: 2,11
3333
3434
# File: forms.py
35-
from bootstrap_datepicker_plus import DatePickerInput
35+
from bootstrap_datepicker_plus.widgets import DatePickerInput
3636
from .models import Event
3737
from django import forms
3838
@@ -53,7 +53,7 @@ Model Form usage
5353
:emphasize-lines: 2,11-12
5454
5555
# File: forms.py
56-
from bootstrap_datepicker_plus import DatePickerInput
56+
from bootstrap_datepicker_plus.widgets import DatePickerInput
5757
from .models import Event
5858
from django import forms
5959
@@ -77,7 +77,7 @@ The widget contains all types of date-picker you may ever need.
7777
:emphasize-lines: 2,11-15
7878
7979
# File: forms.py
80-
from bootstrap_datepicker_plus import DatePickerInput, TimePickerInput, DateTimePickerInput, MonthPickerInput, YearPickerInput
80+
from bootstrap_datepicker_plus.widgets import DatePickerInput, TimePickerInput, DateTimePickerInput, MonthPickerInput, YearPickerInput
8181
from .models import Event
8282
from django import forms
8383
@@ -104,7 +104,7 @@ DatePickers can be linked to select a date-range or time-range.
104104
:emphasize-lines: 2,11-14
105105
106106
# File: forms.py
107-
from bootstrap_datepicker_plus import DatePickerInput, TimePickerInput
107+
from bootstrap_datepicker_plus.widgets import DatePickerInput, TimePickerInput
108108
from .models import Event
109109
from django import forms
110110
@@ -132,7 +132,7 @@ The ``options`` will be passed to the JavaScript datepicker instance, and are do
132132
:emphasize-lines: 14-17
133133
134134
# File: forms.py
135-
from bootstrap_datepicker_plus import DatePickerInput
135+
from bootstrap_datepicker_plus.widgets import DatePickerInput
136136
from .models import Event
137137
from django import forms
138138
@@ -170,7 +170,7 @@ In order to use arbitraty formats you must specify the pattern to the field's ``
170170
:emphasize-lines: 11-12
171171
172172
# File: forms.py
173-
from bootstrap_datepicker_plus import DatePickerInput
173+
from bootstrap_datepicker_plus.widgets import DatePickerInput
174174
from .models import Event
175175
from django import forms
176176
@@ -195,7 +195,7 @@ See `moment.js locales <https://github.com/moment/moment/tree/develop/locale>`_
195195
:emphasize-lines: 14
196196
197197
# File: forms.py
198-
from bootstrap_datepicker_plus import DatePickerInput
198+
from bootstrap_datepicker_plus.widgets import DatePickerInput
199199
from .models import Event
200200
from django import forms
201201

docs/Walkthrough.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Add a CreateView for Question model. The ``get_form`` method is used to specify
5858
from django.urls import reverse
5959
from django.views import generic
6060
61-
from bootstrap_datepicker_plus import DateTimePickerInput
61+
from bootstrap_datepicker_plus.widgets import DateTimePickerInput
6262
6363
from .models import Choice, Question
6464

docs/index.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
django-bootstrap-datepicker-plus documentation
33
##################################################
44

5-
This django widget contains Bootstrap 3 and Bootstrap 4
5+
This django widget contains Bootstrap 3, Bootstrap 4 and Bootstrap 5
66
Date-Picker, Time-Picker, DateTime-Picker, Month-Picker and Year-Picker input
7-
with date-range-picker functionality for django version 2.1, 2.0, 1.11, 1.10 and 1.8.
7+
with date-range-picker functionality for django version >= 1.8.
88
The widget implements `bootstrap-datetimepicker v4 <http://eonasdan.github.io/bootstrap-datetimepicker/>`_
99
to show bootstrap-datepicker in django model forms and custom forms
1010
which can be configured easily for date-range selection.

setup.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ def readme():
1111
setup(
1212
name="django-bootstrap-datepicker-plus",
1313
version=bootstrap_datepicker_plus.__version__,
14-
description="Bootstrap3/Bootstrap4 DatePickerInput, TimePickerInput, "
14+
description="Bootstrap3/Bootstrap4/Bootstrap5 DatePickerInput, TimePickerInput, "
1515
"DateTimePickerInput, MonthPickerInput, YearPickerInput "
16-
"with date-range-picker functionality for django version 1.11, 1.10 and 1.8",
16+
"with date-range-picker functionality for django version >= 1.8",
1717
long_description=readme(),
1818
url="https://github.com/monim67/django-bootstrap-datepicker-plus",
1919
author="Munim Munna",
@@ -22,7 +22,7 @@ def readme():
2222
keywords="django bootstrap date-picker time-picker datetime-picker "
2323
"date-range-picker",
2424
packages=["bootstrap_datepicker_plus"],
25-
install_requires=["django>=1.8,<2.0",],
25+
install_requires=["django>=1.8",],
2626
python_requires=">=3.6",
2727
package_data={
2828
"bootstrap_datepicker_plus": [

0 commit comments

Comments
 (0)