diff --git a/docs/source/1to2.rst b/docs/source/1to2.rst index 9598b37c9..2e2aec8e8 100644 --- a/docs/source/1to2.rst +++ b/docs/source/1to2.rst @@ -82,6 +82,35 @@ consider the :ref:`DRY breaking ` implications (which are not specific to django-autocomplete-light, but Django's design in general). +Specification of the Autocomplete class to use +---------------------------------------------- + +New rules are: + +- if an Autocomplete class was registered for a model then it becomes the + default Autocomplete class for autocompletion on that model, +- other Autocomplete classes registered for a model will not be used by default + +You can still define the Autocomplete class you want in the field definition: + +.. code-block:: python + + class FooForm(autocomplete_light.ModelForm): + bar = autocomplete_light.ModelChoiceField('SpecialBarAutocomplete') + + class Meta: + model = Foo + +But this will break some :ref:`break django DRY logic`. Instead, +this won't break DRY: + +.. code-block:: python + + class FooForm(autocomplete_light.ModelForm): + class Meta: + model = Foo + autocomplete_names = {'bar': 'SpecialBarAutocomplete'} + Python class re-organisation ----------------------------