Skip to content

Commit

Permalink
Fix #229: explain how to specify Autocomplete classes to use
Browse files Browse the repository at this point in the history
  • Loading branch information
jpic committed Jan 21, 2014
1 parent 4ce515a commit 5c4e378
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/source/1to2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,35 @@ consider the :ref:`DRY breaking <dry-break>` 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<dry-break>`. 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
----------------------------

Expand Down

0 comments on commit 5c4e378

Please sign in to comment.