Skip to content

Commit

Permalink
Merge branch 'release/7.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
dyve committed Mar 23, 2016
2 parents 4d6be89 + 1ad2686 commit 4c19464
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
9 changes: 7 additions & 2 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
History
-------

7.0.1 (2016-03-23)
++++++++++++++++++

7.0.0 (in progress)
+++++++++++++++++++
* Fixed bug with widget attrs consistency (@onysos)


7.0.0 (2016-02-24)
++++++++++++++++++

* Dropped support for Django < 1.8
* Dropped support for Python < 2.7
Expand Down
2 changes: 1 addition & 1 deletion bootstrap3/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-

__version__ = '7.0.0'
__version__ = '7.0.1'
5 changes: 1 addition & 4 deletions bootstrap3/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
from __future__ import unicode_literals

from django.conf import settings
try:
from importlib import import_module
except ImportError:
from django.utils.importlib import import_module
from importlib import import_module


# Default settings
Expand Down
6 changes: 3 additions & 3 deletions bootstrap3/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ def __init__(self, field, *args, **kwargs):
else:
self.placeholder = ''

self.addon_before = kwargs.get('addon_before', self.initial_attrs.pop('addon_before', ''))
self.addon_after = kwargs.get('addon_after', self.initial_attrs.pop('addon_after', ''))
self.addon_before = kwargs.get('addon_before', self.widget.attrs.pop('addon_before', ''))
self.addon_after = kwargs.get('addon_after', self.widget.attrs.pop('addon_after', ''))

# These are set in Django or in the global BOOTSTRAP3 settings, and
# they can be overwritten in the template
Expand Down Expand Up @@ -274,7 +274,7 @@ def __init__(self, field, *args, **kwargs):
self.set_disabled = kwargs.get('set_disabled', False)

def restore_widget_attrs(self):
self.widget.attrs = self.initial_attrs
self.widget.attrs = self.initial_attrs.copy()

def add_class_attrs(self, widget=None):
if widget is None:
Expand Down
13 changes: 13 additions & 0 deletions bootstrap3/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,19 @@ def test_datetime(self):
self.assertIn('vDateField', field)
self.assertIn('vTimeField', field)

def test_field_same_render(self):
context = dict(form=TestForm())
rendered_a = render_form_field("addon", context)
rendered_b = render_form_field("addon", context)
self.assertEqual(rendered_a, rendered_b)

def test_attributes_consistency(self):
form = TestForm()
attrs = form.fields['addon'].widget.attrs.copy()
context = dict(form=form)
field_alone = render_form_field("addon", context)
self.assertEqual(attrs, form.fields['addon'].widget.attrs)


class ComponentsTest(TestCase):
def test_icon(self):
Expand Down

0 comments on commit 4c19464

Please sign in to comment.