diff --git a/.travis.yml b/.travis.yml index 0588252..b1a1315 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,75 +2,42 @@ language: python matrix: include: - - python: 2.7 + - python: 3.7 env: - - TOX_ENV=py27-dj15 - - python: 2.7 + - TOX_ENV=py37-dj22 + - python: 3.7 env: - - TOX_ENV=py27-dj16 - - python: 2.7 + - TOX_ENV=py37-dj32 + - python: 3.7 env: - - TOX_ENV=py27-dj17 - - python: 2.7 + - TOX_ENV=py37-dj40 + - python: 3.8 env: - - TOX_ENV=py27-dj18 - - python: 2.7 + - TOX_ENV=py38-dj22 + - python: 3.8 env: - - TOX_ENV=py27-dj19 - - python: 2.7 + - TOX_ENV=py38-dj32 + - python: 3.8 env: - - TOX_ENV=py27-dj110 - - python: 2.7 + - TOX_ENV=py38-dj40 + - python: 3.9 env: - - TOX_ENV=py27-dj111 - - python: 2.7 + - TOX_ENV=py39-dj22 + - python: 3.9 env: - - TOX_ENV=py34-dj15 - - python: 3.4 + - TOX_ENV=py39-dj32 + - python: 3.9 env: - - TOX_ENV=py34-dj16 - - python: 3.4 + - TOX_ENV=py39-dj40 + - python: 3.10 env: - - TOX_ENV=py34-dj17 - - python: 3.4 + - TOX_ENV=py310-dj22 + - python: 3.10 env: - - TOX_ENV=py34-dj18 - - python: 3.4 + - TOX_ENV=py310-dj32 + - python: 3.10 env: - - TOX_ENV=py34-dj19 - - python: 3.4 - env: - - TOX_ENV=py34-dj110 - - python: 3.4 - env: - - TOX_ENV=py34-dj111 - - python: 3.4 - env: - - TOX_ENV=py34-dj20 - - python: 3.5 - env: - - TOX_ENV=py35-dj18 - - python: 3.5 - env: - - TOX_ENV=py35-dj19 - - python: 3.5 - env: - - TOX_ENV=py35-dj110 - - python: 3.5 - env: - - TOX_ENV=py35-dj111 - - python: 3.5 - env: - - TOX_ENV=py35-dj20 - - python: 3.6 - env: - - TOX_ENV=py36-dj110 - - python: 3.6 - env: - - TOX_ENV=py36-dj111 - - python: 3.6 - env: - - TOX_ENV=py36-dj20 + - TOX_ENV=py310-dj40 install: - pip install tox coverage coveralls diff --git a/bootstrapform/fixtures/basic_dj16.html b/bootstrapform/fixtures/basic_dj40.html similarity index 76% rename from bootstrapform/fixtures/basic_dj16.html rename to bootstrapform/fixtures/basic_dj40.html index a2c238e..bfe2b5e 100644 --- a/bootstrapform/fixtures/basic_dj16.html +++ b/bootstrapform/fixtures/basic_dj40.html @@ -21,21 +21,21 @@
@@ -56,11 +56,11 @@
-
    -
  • -
  • -
  • -
+
+
+
+
+
@@ -83,7 +83,7 @@
-
diff --git a/bootstrapform/fixtures/basic_old.html b/bootstrapform/fixtures/basic_old.html deleted file mode 100644 index 6ef1d14..0000000 --- a/bootstrapform/fixtures/basic_old.html +++ /dev/null @@ -1,99 +0,0 @@ -
- -
- -
-
- -
- -
- -
-
- -
- -
-
- -
- -
- -
- -
- -
-
-
- -
- -
- -
-
- -
- -
-
    -
  • -
  • -
  • -
-
-
- -
- - -
- -
-
- -
- - -
- -
-
- -
- -
- -
-
- -
-
-
- -
-
-
diff --git a/bootstrapform/fixtures/horizontal_dj16.html b/bootstrapform/fixtures/horizontal_dj40.html similarity index 78% rename from bootstrapform/fixtures/horizontal_dj16.html rename to bootstrapform/fixtures/horizontal_dj40.html index 506d25a..4109114 100644 --- a/bootstrapform/fixtures/horizontal_dj16.html +++ b/bootstrapform/fixtures/horizontal_dj40.html @@ -24,19 +24,19 @@
@@ -58,11 +58,11 @@
-
    -
  • -
  • -
  • -
+
+
+
+
+
@@ -86,7 +86,7 @@
-
diff --git a/bootstrapform/fixtures/horizontal_old.html b/bootstrapform/fixtures/horizontal_old.html deleted file mode 100644 index fcc1fcd..0000000 --- a/bootstrapform/fixtures/horizontal_old.html +++ /dev/null @@ -1,102 +0,0 @@ -
- - -
- -
-
- -
- - -
- -
-
- -
- - -
-
- -
-
- -
-
- -
-
-
- -
- - -
- -
-
- -
- -
-
    -
  • -
  • -
  • -
-
-
- -
- - -
- -
-
- -
- - -
- -
-
- -
- - -
- -
-
- -
-
-
- -
-
-
diff --git a/bootstrapform/templates/bootstrapform/field.html b/bootstrapform/templates/bootstrapform/field.html index bfbdf64..6b4fd9b 100644 --- a/bootstrapform/templates/bootstrapform/field.html +++ b/bootstrapform/templates/bootstrapform/field.html @@ -20,7 +20,7 @@ {% endif %}
- {% elif field|is_radio %} + {% elif field|is_radio and not field|is_multiple_checkbox %} {% if field.auto_id %} {% endif %} diff --git a/bootstrapform/templatetags/bootstrap.py b/bootstrapform/templatetags/bootstrap.py index b0dcc75..1dc53af 100644 --- a/bootstrapform/templatetags/bootstrap.py +++ b/bootstrapform/templatetags/bootstrap.py @@ -79,9 +79,6 @@ def render(element, markup_classes): context = {'form': element, 'classes': markup_classes} - if django_version < (1, 8): - context = Context(context) - return template.render(context) diff --git a/bootstrapform/tests.py b/bootstrapform/tests.py index f56f39b..74a3278 100644 --- a/bootstrapform/tests.py +++ b/bootstrapform/tests.py @@ -18,7 +18,6 @@ ) try: - # required by Django 1.7 and later django.setup() except: pass @@ -44,12 +43,10 @@ def test_basic_form(self): html = Template("{% load bootstrap %}{{ form|bootstrap }}").render(Context({'form': form})) - if StrictVersion(django.get_version()) >= StrictVersion('1.7'): - fixture = 'basic.html' - elif StrictVersion(django.get_version()) >= StrictVersion('1.6'): - fixture = 'basic_dj16.html' + if StrictVersion(django.get_version()) >= StrictVersion('4.0'): + fixture = 'basic_dj40.html' else: - fixture = 'basic_old.html' + fixture = 'basic.html' tpl = os.path.join('fixtures', fixture) with open(os.path.join(TEST_DIR, tpl)) as f: @@ -62,12 +59,10 @@ def test_horizontal_form(self): html = Template("{% load bootstrap %}{{ form|bootstrap_horizontal }}").render(Context({'form': form})) - if StrictVersion(django.get_version()) >= StrictVersion('1.7'): - fixture = 'horizontal.html' - elif StrictVersion(django.get_version()) >= StrictVersion('1.6'): - fixture = 'horizontal_dj16.html' + if StrictVersion(django.get_version()) >= StrictVersion('4.0'): + fixture = 'horizontal_dj40.html' else: - fixture = 'horizontal_old.html' + fixture = 'horizontal.html' tpl = os.path.join('fixtures', fixture) with open(os.path.join(TEST_DIR, tpl)) as f: diff --git a/runtests.py b/runtests.py index 935d781..c3abd65 100644 --- a/runtests.py +++ b/runtests.py @@ -6,25 +6,6 @@ from django.conf import settings -middleware = ( - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', - ) - - -if django.VERSION < (1, 10): - middleware_arg = { - 'MIDDLEWARE_CLASSES': middleware, - } -else: - middleware_arg = { - 'MIDDLEWARE': middleware, - } - settings.configure( DATABASES = { 'default': { @@ -33,13 +14,20 @@ } }, INSTALLED_APPS=[ - 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'bootstrapform', ], + MIDDLEWARE = ( + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', + ), SITE_ID=1, DEBUG=False, ROOT_URLCONF='', @@ -54,7 +42,6 @@ }, }, ], - **middleware_arg ) diff --git a/setup.py b/setup.py index 1b08374..dac8aac 100644 --- a/setup.py +++ b/setup.py @@ -10,12 +10,10 @@ "Topic :: Software Development :: Libraries :: Python Modules", "Framework :: Django", "Environment :: Web Environment", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", - "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", ], keywords='bootstrap,django', author='tzangms', @@ -23,8 +21,8 @@ url='http://github.com/tzangms/django-bootstrap-form', license='MIT', test_suite='runtests.runtests', - install_requires = [ - "django>=1.5", + install_requires=[ + "django>=2.2", ], packages=find_packages(), include_package_data=True, diff --git a/tests/test_settings.py b/tests/test_settings.py index a0f2f9f..e9f4481 100644 --- a/tests/test_settings.py +++ b/tests/test_settings.py @@ -31,7 +31,6 @@ 'django.contrib.sessions', 'django.contrib.staticfiles', 'django.contrib.auth', - 'django.contrib.admin', 'bootstrapform', ] diff --git a/tox.ini b/tox.ini index 413d561..503ff98 100644 --- a/tox.ini +++ b/tox.ini @@ -1,28 +1,23 @@ [tox] -envlist = {py27,py34,py35,py36}-dj{15,16,17,18,19,110,111,20} +envlist = {py37,py38,py39,py310}-dj{22,32,40} skipsdist=True [testenv] basepython = - py27: python2.7 - py34: python3.4 - py35: python3.5 - py36: python3.6 + py37: python3.7 + py38: python3.8 + py39: python3.9 + py310: python3.10 deps = pytest - dj15: django>=1.5,<1.6 - dj16: django>=1.6,<1.7 - dj17: django>=1.7,<1.8 - dj18: django>=1.8,<1.9 - dj19: django>=1.9,<1.10 - dj110: django>=1.10,<1.11 - dj111: django>=1.10,<1.11 - dj20: django>=2.0,<2.1 + dj22: django>=2.2,<3.0 + dj32: django>=3.2,<4.0 + dj40: django>=4.0,<4.1 commands = python setup.py test -[testenv:py27-cov] +[testenv:py310-cov] deps = - dj18: Django>=1.8,<1.9 + dj40: Django>=4.0,<4.1 command = coverage run --source=bootstrapform setup.py test