Skip to content

Commit

Permalink
- bugfix: passing a copy of attributes to BoundField, otherwise it is…
Browse files Browse the repository at this point in the history
… used as a mutable object
  • Loading branch information
theorm committed Sep 25, 2011
1 parent 5c4f80c commit 4ec3484
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions bootstrap/forms/templates/bootstrap/forms/inline_field.html
Expand Up @@ -8,8 +8,10 @@
<div class="inline-inputs">
{% for field in fields %}
{% if field.field %}
{# it's a field #}
{{field.field}}
{% else %}
{# it's a text #}
{{field}}
{% endif %}
{% endfor %}
Expand Down
6 changes: 3 additions & 3 deletions bootstrap/forms/templatetags/bootstrap_forms.py
Expand Up @@ -28,7 +28,7 @@ def render(self,ctx):
contexts = tuple()
for field in [f.resolve(ctx) for f in self.args]:
if isinstance(field,BoundField):
contexts = contexts + (_bound_field_context(field,widget_attrs=attrs),)
contexts = contexts + (_bound_field_context(field,widget_attrs=attrs.copy()),)
else:
contexts = contexts + (field,)

Expand All @@ -49,7 +49,7 @@ def render(self,ctx):

context = {}

context['field'] = _bound_field_context(self.args[0].resolve(ctx),widget_attrs=attrs)
context['field'] = _bound_field_context(self.args[0].resolve(ctx),widget_attrs=attrs.copy())
if isinstance(addon,BoundField):
context['addon'] = _bound_field_context(addon)
else:
Expand All @@ -61,7 +61,7 @@ def render(self,ctx):
return template.render(Context(context))
else:
template = get_template(TEMPLATE_PREFIX % "field.html")
context = _bound_field_context(self.args[0].resolve(ctx),widget_attrs=attrs)
context = _bound_field_context(self.args[0].resolve(ctx),widget_attrs=attrs.copy())
return template.render(Context(context))

@register.tag
Expand Down

0 comments on commit 4ec3484

Please sign in to comment.