diff --git a/autocomplete_light/templates/autocomplete_light/widget.html b/autocomplete_light/templates/autocomplete_light/widget.html
index c37bcbb5e..31bed6e57 100644
--- a/autocomplete_light/templates/autocomplete_light/widget.html
+++ b/autocomplete_light/templates/autocomplete_light/widget.html
@@ -18,7 +18,7 @@
{% block input %}
{# a text input, that is the 'autocomplete input' #}
-
+
{% endblock %}
{% block add_another %}
diff --git a/autocomplete_light/tests/widgets.py b/autocomplete_light/tests/widgets.py
index e228a68cf..302200939 100644
--- a/autocomplete_light/tests/widgets.py
+++ b/autocomplete_light/tests/widgets.py
@@ -75,7 +75,7 @@ def test_base_context(self, render_to_string):
'widget': widget,
'choices': mock.ANY,
'autocomplete': mock.ANY,
- 'input_attrs': mock.ANY,
+ 'attrs': mock.ANY,
'widget_attrs': mock.ANY,
'name': 'somewidget',
'values': [],
@@ -93,7 +93,7 @@ def test_extra_context(self, render_to_string):
'widget': widget,
'choices': mock.ANY,
'autocomplete': mock.ANY,
- 'input_attrs': mock.ANY,
+ 'attrs': mock.ANY,
'widget_attrs': mock.ANY,
'name': 'somewidget',
'values': [],
diff --git a/autocomplete_light/widgets.py b/autocomplete_light/widgets.py
index a925c0e59..bfc1dbb09 100644
--- a/autocomplete_light/widgets.py
+++ b/autocomplete_light/widgets.py
@@ -147,8 +147,8 @@ def __init__(self, autocomplete=None, widget_js_attributes=None,
def render(self, name, value, attrs=None):
widget_attrs = self.build_widget_attrs(name)
- input_attrs = self.build_attrs(attrs)
- self.html_id = input_attrs.pop('id', name)
+ attrs = self.build_attrs(attrs)
+ self.html_id = attrs.pop('id', name)
autocomplete = self.autocomplete(values=value)
choices = autocomplete.choices_for_values()
@@ -159,7 +159,7 @@ def render(self, name, value, attrs=None):
'values': values,
'choices': choices,
'widget': self,
- 'input_attrs': safestring.mark_safe(flatatt(input_attrs)),
+ 'attrs': safestring.mark_safe(flatatt(attrs)),
'widget_attrs': safestring.mark_safe(flatatt(widget_attrs)),
'autocomplete': autocomplete,
}
@@ -170,7 +170,7 @@ def render(self, name, value, attrs=None):
return safestring.mark_safe(render_to_string(template, context))
def build_attrs(self, extra_attrs=None, **kwargs):
- self.attrs.update(getattr(self.autocomplete, 'input_attrs', {}))
+ self.attrs.update(getattr(self.autocomplete, 'attrs', {}))
attrs = super(WidgetBase, self).build_attrs(extra_attrs, **kwargs)
if 'class' not in attrs.keys():
diff --git a/docs/source/1to2.rst b/docs/source/1to2.rst
index 2e2aec8e8..4228af074 100644
--- a/docs/source/1to2.rst
+++ b/docs/source/1to2.rst
@@ -150,7 +150,7 @@ Should now be:
class PersonAutocomplete(autocomplete_light.AutocompleteModelBase):
model = Person
- input_attrs = {
+ attrs = {
'data-autcomplete-minimum-characters': 0,
'placeholder': 'foo',
}
@@ -158,7 +158,7 @@ Should now be:
As you probably understand already magic inside
``autocomplete_js_attributes`` and ``widget_js_attributes`` is gone,
-we're just setting plain simple HTML attributes now with :py:attr:`input_attrs `.
+we're just setting plain simple HTML attributes now with :py:attr:`attrs `.
Also notice the other two differences which are detailed below:
diff --git a/docs/source/cookbook.rst b/docs/source/cookbook.rst
index 525d555eb..4c23b8142 100644
--- a/docs/source/cookbook.rst
+++ b/docs/source/cookbook.rst
@@ -28,7 +28,7 @@ Various cooking recipes ``your_app/autocomplete_light_registry.py``:
# It is possible to override javascript options from Python.
autocomplete_light.register(OtherModel,
- input_attrs={
+ attrs={
# This will actually data-autocomplete-minimum-characters which
# will set widget.autocomplete.minimumCharacters.
'data-autocomplete-minimum-characters': 0,
@@ -40,7 +40,7 @@ Various cooking recipes ``your_app/autocomplete_light_registry.py``:
class YourModelAutocomplete(autocomplete_light.AutocompleteModelTemplate):
template_name = 'your_app/your_special_choice_template.html'
- input_attrs = {
+ attrs = {
'data-mininum-minimum-characters': 4,
'placeholder': 'choose your model',
}
diff --git a/docs/source/script.rst b/docs/source/script.rst
index bb5c68983..30b627bd8 100644
--- a/docs/source/script.rst
+++ b/docs/source/script.rst
@@ -131,7 +131,7 @@ These options can be set with the ``register()`` shortcut:
.. code-block:: python
autocomplete_light.register(Person,
- input_attrs={
+ attrs={
'placeholder': 'foo',
'data-autocomplete-minimum-characters': 0
},
@@ -147,7 +147,7 @@ Or equivalently on a Python Autocomplete class:
class YourAutocomplete(autocomplete_light.AutocompleteModelBase):
model = Person
- input_attrs={
+ attrs={
'placeholder': 'foo',
'data-autocomplete-minimum-characters': 0
},
@@ -169,7 +169,7 @@ Or via the Python widget class:
)
**NOTE** the difference of the option name here. It is ``attrs`` to match
-django and not ``input_attrs``. Note that ``Autocomplete.input_attrs`` might be
+django and not ``attrs``. Note that ``Autocomplete.attrs`` might be
renamed to ``Autocomplete.attrs`` before v2 hits RC.
Override autocomplete JS options in JS