Skip to content

Commit 6e65a6a

Browse files
committed
Drop support for django<2.0
1 parent 415e82f commit 6e65a6a

File tree

14 files changed

+42
-192
lines changed

14 files changed

+42
-192
lines changed

README.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ django-bootstrap-datepicker-plus
44

55
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 >= 1.8.
7+
with date-range-picker functionality for django version >= 2.0.
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.
1111

1212

1313
| |build-status| |docs-status| |coverage|
14-
| |pyversions| |pypi-version| |license|
14+
| |pyversions| |djversions| |pypi-version| |license|
1515
1616
| |date-picker-image| |datetime-picker-image| |time-picker-image|
1717
@@ -202,7 +202,7 @@ The project was initially forked from `pbucher/django-bootstrap-datepicker <http
202202
:height: 280px
203203

204204
.. |build-status| image:: https://github.com/monim67/django-bootstrap-datepicker-plus/workflows/build/badge.svg?event=push
205-
:target: https://github.com/monim67/django-bootstrap-datepicker-plus/actions?query=build
205+
:target: https://github.com/monim67/django-bootstrap-datepicker-plus/actions/workflows/build.yml
206206
:alt: Build Status
207207
:height: 20px
208208

@@ -221,6 +221,11 @@ The project was initially forked from `pbucher/django-bootstrap-datepicker <http
221221
:alt: Python Versions
222222
:height: 20px
223223

224+
.. |djversions| image:: https://img.shields.io/pypi/djversions/django-bootstrap-datepicker-plus.svg
225+
:target: https://pypi.python.org/pypi/django-bootstrap-datepicker-plus
226+
:alt: DJango Versions
227+
:height: 20px
228+
224229
.. |pypi-version| image:: https://badge.fury.io/py/django-bootstrap-datepicker-plus.svg
225230
:target: https://pypi.python.org/pypi/django-bootstrap-datepicker-plus
226231
:alt: PyPI version

bootstrap_datepicker_plus/_base.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33

44
from json import dumps as json_dumps
55

6-
from ._helpers import DatePickerDictionary, get_base_input
6+
from django.forms.widgets import DateTimeBaseInput
77

8+
from ._helpers import DatePickerDictionary
89

9-
class BasePickerInput(get_base_input()):
10+
11+
class BasePickerInput(DateTimeBaseInput):
1012
"""Base Date-Picker input class for widgets of this package."""
1113

1214
template_name = "bootstrap_datepicker_plus/date-picker.html"

bootstrap_datepicker_plus/_compatibility.py

Lines changed: 0 additions & 111 deletions
This file was deleted.

bootstrap_datepicker_plus/_helpers.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,6 @@
11
"""Contains the helper classes and methods used throughout the project."""
22

33

4-
def get_base_input(test=False):
5-
"""
6-
Return DateTimeBaseInput class from django.forms.widgets module
7-
8-
Return _compatibility.DateTimeBaseInput class for older django versions.
9-
"""
10-
from django.forms.widgets import DateTimeBaseInput
11-
12-
if "get_context" in dir(DateTimeBaseInput) and not test:
13-
# django version 1.11 and above
14-
base_input = DateTimeBaseInput
15-
else:
16-
# django version below 1.11
17-
from bootstrap_datepicker_plus._compatibility import CompatibleDateTimeBaseInput
18-
19-
base_input = CompatibleDateTimeBaseInput
20-
return base_input
21-
22-
234
class DatePickerDictionary:
245
"""Keeps track of all date-picker input classes."""
256

dev/myapp/models.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,3 @@ class Event(models.Model):
1616

1717
def __str__(self):
1818
return str(self.name)
19-
20-
def get_absolute_url(self):
21-
return "/dpp_test/event/" + str(self.pk)

dev/myapp/urls.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from django.conf.urls import url
1+
from django.urls import path
22
from django.views.generic import RedirectView
33

44
from . import views
@@ -7,9 +7,9 @@
77

88
urlpatterns = [
99
# fmt: off
10-
url(r"^$", RedirectView.as_view(pattern_name="myapp:bootstrap3.custom-form", permanent=False)),
11-
url("bootstrap3/custom-form.html", views.Bootstrap3_CustomFormView.as_view(), name="bootstrap3.custom-form"),
12-
url(r"^bootstrap3/model-form-(?P<pk>[0-9]+).html$", views.Bootstrap3_UpdateView.as_view(), name="bootstrap3.model-form-1"),
13-
url("bootstrap4/custom-form.html", views.Bootstrap4_CustomFormView.as_view(), name="bootstrap4.custom-form"),
14-
url(r"^bootstrap4/model-form-(?P<pk>[0-9]+).html$", views.Bootstrap4_UpdateView.as_view(), name="bootstrap4.model-form-1"),
10+
path("", RedirectView.as_view(pattern_name="myapp:bootstrap3.custom-form", permanent=False)),
11+
path("bootstrap3/custom-form.html", views.Bootstrap3_CustomFormView.as_view(), name="bootstrap3.custom-form"),
12+
path("bootstrap3/model-form-<int:pk>.html", views.Bootstrap3_UpdateView.as_view(), name="bootstrap3.model-form-1"),
13+
path("bootstrap4/custom-form.html", views.Bootstrap4_CustomFormView.as_view(), name="bootstrap4.custom-form"),
14+
path("bootstrap4/model-form-<int:pk>.html", views.Bootstrap4_UpdateView.as_view(), name="bootstrap4.model-form-1"),
1515
]

dev/myapp/views.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@ class Bootstrap3_UpdateView(UpdateView):
2626
model = Event
2727
form_class = EventForm
2828

29+
def get_success_url(self):
30+
return self.request.META.get("HTTP_REFERER")
31+
2932

3033
class Bootstrap4_UpdateView(UpdateView):
3134
template_name = "myapp/bootstrap4/model-form.html"
3235
model = Event
3336
form_class = EventForm
37+
38+
def get_success_url(self):
39+
return self.request.META.get("HTTP_REFERER")

dev/mysite/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
ALLOWED_HOSTS = []
3232

33+
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
3334

3435
# Application definition
3536

dev/mysite/urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from django.conf.urls import include, url
1+
from django.urls import path, include
22

33
urlpatterns = [
4-
url(r"^", include("myapp.urls")),
4+
path("", include("myapp.urls")),
55
]

docs/index.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ django-bootstrap-datepicker-plus documentation
44

55
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 >= 1.8.
7+
with date-range-picker functionality for django version >= 2.0.
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.
1111

1212

1313
| |build-status| |docs-status| |coverage|
14-
| |pyversions| |pypi-version| |license|
14+
| |pyversions| |djversions| |pypi-version| |license|
1515
1616
| |date-picker-image| |datetime-picker-image| |time-picker-image|
1717
@@ -55,7 +55,7 @@ Demo
5555
:height: 280px
5656

5757
.. |build-status| image:: https://github.com/monim67/django-bootstrap-datepicker-plus/workflows/build/badge.svg?event=push
58-
:target: https://github.com/monim67/django-bootstrap-datepicker-plus/actions?query=build
58+
:target: https://github.com/monim67/django-bootstrap-datepicker-plus/actions/workflows/build.yml
5959
:alt: Build Status
6060
:height: 20px
6161

@@ -74,6 +74,11 @@ Demo
7474
:alt: Python Versions
7575
:height: 20px
7676

77+
.. |djversions| image:: https://img.shields.io/pypi/djversions/django-bootstrap-datepicker-plus.svg
78+
:target: https://pypi.python.org/pypi/django-bootstrap-datepicker-plus
79+
:alt: DJango Versions
80+
:height: 20px
81+
7782
.. |pypi-version| image:: https://badge.fury.io/py/django-bootstrap-datepicker-plus.svg
7883
:target: https://pypi.python.org/pypi/django-bootstrap-datepicker-plus
7984
:alt: PyPI version

0 commit comments

Comments
 (0)