From c02e94914adc04c17778ecce2f878e69ee147df9 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 4 Dec 2015 14:19:22 +0530 Subject: [PATCH 1/2] Fix deprecation warnings on Django 1.9 --- bootstrapform/templatetags/bootstrap.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bootstrapform/templatetags/bootstrap.py b/bootstrapform/templatetags/bootstrap.py index a8b96de..2cfb087 100644 --- a/bootstrapform/templatetags/bootstrap.py +++ b/bootstrapform/templatetags/bootstrap.py @@ -1,3 +1,4 @@ +import django from django import forms from django.template import Context from django.template.loader import get_template @@ -60,7 +61,7 @@ def render(element, markup_classes): if element_type == 'boundfield': add_input_classes(element) template = get_template("bootstrapform/field.html") - context = Context({'field': element, 'classes': markup_classes, 'form': element.form}) + context = {'field': element, 'classes': markup_classes, 'form': element.form} else: has_management = getattr(element, 'management_form', None) if has_management: @@ -69,13 +70,16 @@ def render(element, markup_classes): add_input_classes(field) template = get_template("bootstrapform/formset.html") - context = Context({'formset': element, 'classes': markup_classes}) + context = {'formset': element, 'classes': markup_classes} else: for field in element.visible_fields(): add_input_classes(field) template = get_template("bootstrapform/form.html") - context = Context({'form': element, 'classes': markup_classes}) + context = {'form': element, 'classes': markup_classes} + + if django.VERSION[0] * 1000 + django.VERSION[1] < 1008: + context = Context(context) return template.render(context) From 628b6c944f4606ed700916dc49fcd860bcfda28d Mon Sep 17 00:00:00 2001 From: tzangms Date: Wed, 3 May 2017 17:26:12 +0800 Subject: [PATCH 2/2] fix test error --- .travis.yml | 4 ---- bootstrapform/templatetags/bootstrap.py | 3 ++- tox.ini | 3 ++- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index ebbdcdd..ca5648f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,10 +17,6 @@ env: - TOX_ENV=py34-dj110 - TOX_ENV=py34-dj111 -python: - - "2.7" - - "3.4" - install: - pip install tox coverage coveralls diff --git a/bootstrapform/templatetags/bootstrap.py b/bootstrapform/templatetags/bootstrap.py index ef23db2..9fa4c5c 100644 --- a/bootstrapform/templatetags/bootstrap.py +++ b/bootstrapform/templatetags/bootstrap.py @@ -78,7 +78,8 @@ def render(element, markup_classes): template = get_template("bootstrapform/form.html") context = {'form': element, 'classes': markup_classes} - if django.VERSION[0] * 1000 + django.VERSION[1] < 1008: + + if django_version < (1, 11): context = Context(context) if django_version >= (1, 8): diff --git a/tox.ini b/tox.ini index 360df6d..2408c32 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = {py27,py34}-dj{15,16,17,18,19,110} +envlist = {py27,py34}-dj{15,16,17,18,19,110,111} skipsdist=True @@ -15,6 +15,7 @@ deps = dj18: django>=1.8,<1.9 dj19: django>=1.9,<1.10 dj110: django>=1.10,<1.11 + dj111: django>=1.10,<1.11 commands = python setup.py test