Skip to content

Commit

Permalink
Add Bootstrap 5 support
Browse files Browse the repository at this point in the history
  • Loading branch information
monim67 committed Dec 1, 2021
1 parent 1dd5828 commit c8235bc
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 28 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
django-bootstrap-datepicker-plus
########################################

This django widget contains Bootstrap 3 and Bootstrap 4
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.1, 2.0, 1.11, 1.10 and 1.8.
with date-range-picker functionality for django version >= 1.8.
The widget implements `bootstrap-datetimepicker v4 <http://eonasdan.github.io/bootstrap-datetimepicker/>`_
to show bootstrap-datepicker in django model forms and custom forms
which can be configured easily for date-range selection.
Expand Down
2 changes: 1 addition & 1 deletion bootstrap_datepicker_plus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ def _make_version(major, minor, micro, releaselevel, serial):
return version


version_info = (3, 0, 5, "final", 0)
version_info = (3, 0, 6, "final", 0)
__version__ = _make_version(*version_info)
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
factory(jQuery)
}(function ($) {
var datepickerDict = {};
var isBootstrap4 = $.fn.collapse.Constructor.VERSION.split('.').shift() === "4";
var isBootstrap5 = $.fn.collapse.Constructor.VERSION.split('.').shift() == "5";
const bootstrapVersion = (window.bootstrap?.Collapse||$.fn.collapse.Constructor).VERSION;
var isBootstrap4 = bootstrapVersion.split('.').shift() === "4";
var isBootstrap5 = bootstrapVersion.split('.').shift() === "5";
function fixMonthEndDate(e, picker) {
e.date && picker.val().length && picker.val(e.date.endOf('month').format('YYYY-MM-DD'));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="input-group date">
{% include "bootstrap_datepicker_plus/input.html" %}
<div class="input-group-addon input-group-append" data-target="#datetimepicker1" data-toggle="datetimepickerv">
<div class="input-group-text"><i class="glyphicon glyphicon-calendar"></i></div>
</div>
{% include "bootstrap_datepicker_plus/input.html" %}
<div class="input-group-addon input-group-append input-group-text">
<i class="glyphicon glyphicon-calendar"></i>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="input-group date">
{% include "bootstrap_datepicker_plus/input.html" %}
<div class="input-group-addon input-group-append" data-target="#datetimepicker1" data-toggle="datetimepickerv">
<div class="input-group-text"><i class="glyphicon glyphicon-time"></i></div>
</div>
{% include "bootstrap_datepicker_plus/input.html" %}
<div class="input-group-addon input-group-append input-group-text">
<i class="glyphicon glyphicon-time"></i>
</div>
</div>
2 changes: 1 addition & 1 deletion docs/Template_Customizing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The calendar is not yet available for customizing, but the input field template
.. code:: python
# File: forms.py
from bootstrap_datepicker_plus import DatePickerInput
from bootstrap_datepicker_plus.widgets import DatePickerInput
from django import forms
class MyDatePickerInput(DatePickerInput):
Expand Down
16 changes: 8 additions & 8 deletions docs/Usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Usage in Generic View
:emphasize-lines: 2,11
# File: views.py
from bootstrap_datepicker_plus import DateTimePickerInput
from bootstrap_datepicker_plus.widgets import DateTimePickerInput
from django.views import generic
from .models import Question
Expand All @@ -32,7 +32,7 @@ Custom Form usage
:emphasize-lines: 2,11
# File: forms.py
from bootstrap_datepicker_plus import DatePickerInput
from bootstrap_datepicker_plus.widgets import DatePickerInput
from .models import Event
from django import forms
Expand All @@ -53,7 +53,7 @@ Model Form usage
:emphasize-lines: 2,11-12
# File: forms.py
from bootstrap_datepicker_plus import DatePickerInput
from bootstrap_datepicker_plus.widgets import DatePickerInput
from .models import Event
from django import forms
Expand All @@ -77,7 +77,7 @@ The widget contains all types of date-picker you may ever need.
:emphasize-lines: 2,11-15
# File: forms.py
from bootstrap_datepicker_plus import DatePickerInput, TimePickerInput, DateTimePickerInput, MonthPickerInput, YearPickerInput
from bootstrap_datepicker_plus.widgets import DatePickerInput, TimePickerInput, DateTimePickerInput, MonthPickerInput, YearPickerInput
from .models import Event
from django import forms
Expand All @@ -104,7 +104,7 @@ DatePickers can be linked to select a date-range or time-range.
:emphasize-lines: 2,11-14
# File: forms.py
from bootstrap_datepicker_plus import DatePickerInput, TimePickerInput
from bootstrap_datepicker_plus.widgets import DatePickerInput, TimePickerInput
from .models import Event
from django import forms
Expand Down Expand Up @@ -132,7 +132,7 @@ The ``options`` will be passed to the JavaScript datepicker instance, and are do
:emphasize-lines: 14-17
# File: forms.py
from bootstrap_datepicker_plus import DatePickerInput
from bootstrap_datepicker_plus.widgets import DatePickerInput
from .models import Event
from django import forms
Expand Down Expand Up @@ -170,7 +170,7 @@ In order to use arbitraty formats you must specify the pattern to the field's ``
:emphasize-lines: 11-12
# File: forms.py
from bootstrap_datepicker_plus import DatePickerInput
from bootstrap_datepicker_plus.widgets import DatePickerInput
from .models import Event
from django import forms
Expand All @@ -195,7 +195,7 @@ See `moment.js locales <https://github.com/moment/moment/tree/develop/locale>`_
:emphasize-lines: 14
# File: forms.py
from bootstrap_datepicker_plus import DatePickerInput
from bootstrap_datepicker_plus.widgets import DatePickerInput
from .models import Event
from django import forms
Expand Down
2 changes: 1 addition & 1 deletion docs/Walkthrough.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Add a CreateView for Question model. The ``get_form`` method is used to specify
from django.urls import reverse
from django.views import generic
from bootstrap_datepicker_plus import DateTimePickerInput
from bootstrap_datepicker_plus.widgets import DateTimePickerInput
from .models import Choice, Question
Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
django-bootstrap-datepicker-plus documentation
##################################################

This django widget contains Bootstrap 3 and Bootstrap 4
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.1, 2.0, 1.11, 1.10 and 1.8.
with date-range-picker functionality for django version >= 1.8.
The widget implements `bootstrap-datetimepicker v4 <http://eonasdan.github.io/bootstrap-datetimepicker/>`_
to show bootstrap-datepicker in django model forms and custom forms
which can be configured easily for date-range selection.
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ def readme():
setup(
name="django-bootstrap-datepicker-plus",
version=bootstrap_datepicker_plus.__version__,
description="Bootstrap3/Bootstrap4 DatePickerInput, TimePickerInput, "
description="Bootstrap3/Bootstrap4/Bootstrap5 DatePickerInput, TimePickerInput, "
"DateTimePickerInput, MonthPickerInput, YearPickerInput "
"with date-range-picker functionality for django version 1.11, 1.10 and 1.8",
"with date-range-picker functionality for django version >= 1.8",
long_description=readme(),
url="https://github.com/monim67/django-bootstrap-datepicker-plus",
author="Munim Munna",
Expand All @@ -22,7 +22,7 @@ def readme():
keywords="django bootstrap date-picker time-picker datetime-picker "
"date-range-picker",
packages=["bootstrap_datepicker_plus"],
install_requires=["django>=1.8,<2.0",],
install_requires=["django>=1.8",],
python_requires=">=3.6",
package_data={
"bootstrap_datepicker_plus": [
Expand Down

0 comments on commit c8235bc

Please sign in to comment.