Fixing: Deprecation warnings when used with Django 1.9

This commit is contained in:
Hugo Leonardo Costa e Silva
2016-04-06 15:24:25 -03:00
parent 7d783ad368
commit 7f97ef6b0d

View File

@@ -1,4 +1,4 @@
from django import forms from django import forms, VERSION as django_version
from django.template import Context from django.template import Context
from django.template.loader import get_template from django.template.loader import get_template
from django import template from django import template
@@ -77,6 +77,9 @@ def render(element, markup_classes):
template = get_template("bootstrapform/form.html") template = get_template("bootstrapform/form.html")
context = Context({'form': element, 'classes': markup_classes}) context = Context({'form': element, 'classes': markup_classes})
if django_version >= (1, 8):
context = context.flatten()
return template.render(context) return template.render(context)