Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ env:
- TOX_ENV=py27-dj16
- TOX_ENV=py27-dj17
- TOX_ENV=py27-dj18
- TOX_ENV=py27-dj19
- TOX_ENV=py27-dj110
- TOX_ENV=py27-dj111
- TOX_ENV=py34-dj15
- TOX_ENV=py34-dj16
- TOX_ENV=py34-dj17
- TOX_ENV=py34-dj18

python:
- "2.7"
- "3.4"
- TOX_ENV=py34-dj19
- TOX_ENV=py34-dj110
- TOX_ENV=py34-dj111

install:
- pip install tox coverage coveralls
Expand Down
11 changes: 8 additions & 3 deletions bootstrapform/templatetags/bootstrap.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import django
from django import forms, VERSION as django_version
from django.template import Context
from django.template.loader import get_template
Expand Down Expand Up @@ -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:
Expand All @@ -69,13 +70,17 @@ 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 < (1, 11):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be < (1, 8) since using Context instances has been deprecated as of Django 1.8

context = Context(context)

if django_version >= (1, 8):
context = context.flatten()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this has no reason to be anymore

Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -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


Expand All @@ -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


Expand Down