earle/django-bootstrap — Issue #41: Incorrect fieldset legend if value is django.utils.translation.ugettext_lazy
Author: subuk
Created: 2012-03-09 11:38:02+00:00
State: open

Fix:

```
diff --git a/bootstrap/forms.py b/bootstrap/forms.py
index 988e5e4..7c3f4a7 100755
--- a/bootstrap/forms.py
+++ b/bootstrap/forms.py
@@ -160,11 +160,11 @@ class Fieldset(object):
""" Fieldset container. Renders to a

. """

def __init__(self, legend, *fields, **kwargs):
- self.legend_html = legend and ('
%s
' % legend) or ''
+ self.legend_html = legend and legend or ''
self.fields = fields
self.css_class = kwargs.get('css_class')

def as_html(self, form):
class_str = self.css_class and (' class="%s"' % self.css_class) or ''
- return u'%s%s

' % (class_str, self.legend_html, form.render_fields(self.fields), )
+ return u'
%s
%s

' % (class_str, unicode(self.legend_html), form.render_fields(self.fields), )
```