File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
django_forms_bootstrap/templatetags Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 11from django import template
2- from django .template import Context
32from django .template .loader import get_template
3+ from django import VERSION as DJANGO_VERSION
44
55
6+ if DJANGO_VERSION >= (1 , 10 , 0 ):
7+ context_class = dict
8+ else :
9+ # Django<1.10 compatibility
10+ from django .template import Context
11+ context_class = Context
12+
613register = template .Library ()
714
815
@@ -22,7 +29,7 @@ def as_bootstrap(form):
2229 template = get_template ("bootstrap/form.html" )
2330 form = _preprocess_fields (form )
2431
25- c = Context ({
32+ c = context_class ({
2633 "form" : form ,
2734 })
2835 return template .render (c )
@@ -44,7 +51,7 @@ def as_bootstrap_inline(form):
4451 "wrap" : "" ,
4552 }
4653
47- c = Context ({
54+ c = context_class ({
4855 "form" : form ,
4956 "css_classes" : css_classes ,
5057 })
@@ -81,7 +88,7 @@ def as_bootstrap_horizontal(form, label_classes=""):
8188 css_classes ["single_container" ] += offset_class + " " + wrap_class + " "
8289 css_classes ["wrap" ] += wrap_class + " "
8390
84- c = Context ({
91+ c = context_class ({
8592 "form" : form ,
8693 "css_classes" : css_classes ,
8794 })
You can’t perform that action at this time.
0 commit comments