Skip to content

Commit

Permalink
Merge 111d14f into 1a33d33
Browse files Browse the repository at this point in the history
  • Loading branch information
pwilczynskiclearcode committed Feb 23, 2018
2 parents 1a33d33 + 111d14f commit 86f4740
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ env:
- DJANGO_VERSION=">=1.8, < 1.9"
- DJANGO_VERSION=">=1.9, < 1.10"
- DJANGO_VERSION=">=1.10, < 1.11"
- DJANGO_VERSION=">=1.11, < 2.0"
python:
- 2.7
- 3.5
Expand All @@ -28,5 +29,5 @@ deploy:
distributions: "bdist_wheel sdist"
on:
all_branches: true
condition: $DJANGO_VERSION = ">=1.10, < 1.11"
condition: $DJANGO_VERSION = ">=1.10, < 2.0"
repo: ocadotechnology/django-nuit
16 changes: 13 additions & 3 deletions nuit/templatetags/nuit.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
from __future__ import division
from django import template
from distutils.version import StrictVersion
from django import template, get_version
from django.contrib.messages import constants
from django.core.urlresolvers import resolve, reverse, NoReverseMatch, Resolver404
from django.template.loader import get_template
from django.template.base import token_kwargs, FilterExpression
from django.template.loader_tags import do_extends, ExtendsNode
from django.template.defaultfilters import slugify
from django.utils.html import format_html
from ast import literal_eval
from six.moves.urllib.parse import urlparse
from six import iteritems as _iteritems
from ..utils import user_can_see_view

import asteval


# pylint: disable=C0103

register = template.Library()
Expand All @@ -26,6 +27,9 @@
constants.ERROR: 'alert',
}

IS_DJANGO_1_11_OR_ABOVE = StrictVersion(get_version()) >= StrictVersion('1.11.0')


@register.filter
def message_class(msg):
'''
Expand Down Expand Up @@ -320,6 +324,7 @@ def normalise_row(row_data):
if size not in field_data or not field_data[size]:
field_data[size] = 3


class FoundationFormNode(template.Node):
'''
A template node for a form field capabale of rendering Foundation-specific markup.
Expand Down Expand Up @@ -394,10 +399,15 @@ def render(self, context):
# Each element in a row list is a FoundationFormField object.

try:
return form_template.render(context)
if IS_DJANGO_1_11_OR_ABOVE:
context_dict = context.flatten()
return form_template.render(context_dict, context_dict.get('request'))
else:
return form_template.render(context)
finally:
context.pop()


@register.tag
def foundation_form(parser, token):
'''
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'django-foundation-statics >= 5.4.7-2',
'django-jquery',
'django-foundation-icons>=3.1',
'django < 1.11',
'django < 2.0',
'django-autoconfig',
'django-bourbon',
'django-pipeline >= 1.6.0',
Expand Down

0 comments on commit 86f4740

Please sign in to comment.