From a5370a22ecf6e33a96c38dbffd170828e041de5e Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Tue, 26 Jul 2016 10:59:25 +0200 Subject: [PATCH 1/2] Fix runtests.py settings In Django 1.10, using TEMPLATES= instead of the old style is now mandatory. This patch adds this needed definition. --- runtests.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/runtests.py b/runtests.py index 0efa252..0bb987f 100644 --- a/runtests.py +++ b/runtests.py @@ -1,12 +1,13 @@ #!/usr/bin/env python +import os import sys import django from os.path import dirname, abspath from django.conf import settings - +local_path = lambda path: os.path.join(os.path.dirname(__file__), path) settings.configure( DATABASES = { @@ -34,6 +35,26 @@ SITE_ID=1, DEBUG=False, ROOT_URLCONF='', + + TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [local_path('templates'), ], + 'OPTIONS': { + 'debug': False, + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + 'loaders': [ + 'django.template.loaders.filesystem.Loader', + 'django.template.loaders.app_directories.Loader', + ], + }, + }, +] ) From afe9b64f6954f7bd685d3fd80bb7ad0fe68a7784 Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Tue, 26 Jul 2016 11:00:48 +0200 Subject: [PATCH 2/2] Add new 1.10 compat fixtures In Django 1.10, a new "required" attribute to each form element is added. This fails both unit tests. This patch adds 2 new .html files to use with Django >= 1.10b1. --- bootstrapform/fixtures/basic_dj110.html | 99 ++++++++++++++++++ bootstrapform/fixtures/horizontal_dj110.html | 102 +++++++++++++++++++ bootstrapform/tests.py | 8 +- 3 files changed, 207 insertions(+), 2 deletions(-) create mode 100644 bootstrapform/fixtures/basic_dj110.html create mode 100644 bootstrapform/fixtures/horizontal_dj110.html diff --git a/bootstrapform/fixtures/basic_dj110.html b/bootstrapform/fixtures/basic_dj110.html new file mode 100644 index 0000000..f154c98 --- /dev/null +++ b/bootstrapform/fixtures/basic_dj110.html @@ -0,0 +1,99 @@ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+
+ +
+ +
+
    +
  • +
  • +
  • +
+
+
+ +
+ + +
+ +
+
+ +
+ + +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ +
+
+
diff --git a/bootstrapform/fixtures/horizontal_dj110.html b/bootstrapform/fixtures/horizontal_dj110.html new file mode 100644 index 0000000..8006461 --- /dev/null +++ b/bootstrapform/fixtures/horizontal_dj110.html @@ -0,0 +1,102 @@ +
+ + +
+ +
+
+ +
+ + +
+ +
+
+ +
+ + +
+
+ +
+
+ +
+
+ +
+
+
+ +
+ + +
+ +
+
+ +
+ +
+
    +
  • +
  • +
  • +
+
+
+ +
+ + +
+ +
+
+ +
+ + +
+ +
+
+ +
+ + +
+ +
+
+ +
+
+
+ +
+
+
diff --git a/bootstrapform/tests.py b/bootstrapform/tests.py index 74d8b15..571ac9e 100644 --- a/bootstrapform/tests.py +++ b/bootstrapform/tests.py @@ -43,7 +43,9 @@ def test_basic_form(self): html = Template("{% load bootstrap %}{{ form|bootstrap }}").render(Context({'form': form})) - if StrictVersion(django.get_version()) >= StrictVersion('1.7'): + if StrictVersion(django.get_version()) >= StrictVersion('1.10b1'): + fixture = 'basic_dj110.html' + elif StrictVersion(django.get_version()) >= StrictVersion('1.7'): fixture = 'basic.html' elif StrictVersion(django.get_version()) >= StrictVersion('1.6'): fixture = 'basic_dj16.html' @@ -61,7 +63,9 @@ def test_horizontal_form(self): html = Template("{% load bootstrap %}{{ form|bootstrap_horizontal }}").render(Context({'form': form})) - if StrictVersion(django.get_version()) >= StrictVersion('1.7'): + if StrictVersion(django.get_version()) >= StrictVersion('1.10b1'): + fixture = 'horizontal_dj110.html' + elif StrictVersion(django.get_version()) >= StrictVersion('1.7'): fixture = 'horizontal.html' elif StrictVersion(django.get_version()) >= StrictVersion('1.6'): fixture = 'horizontal_dj16.html'