Skip to content

Commit

Permalink
Fix #212: Document autodiscover and form classes
Browse files Browse the repository at this point in the history
  • Loading branch information
jpic committed Dec 16, 2013
1 parent 81804c2 commit 0674edf
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion docs/source/install.rst
Expand Up @@ -29,7 +29,8 @@ Call ``autocomplete_light.autodiscover()`` *before* ``admin.autodiscover()``
----------------------------------------------------------------------------

In ``urls.py``, call ``autocomplete_light.autodiscover()`` before
``admin.autodiscover()``, it can look like this:
``admin.autodiscover()`` **and before any import of a form with
autocompletes**, it can look like this:

.. code-block:: python
Expand All @@ -40,6 +41,28 @@ In ``urls.py``, call ``autocomplete_light.autodiscover()`` before
import admin
admin.autodiscover()
Also, if you have ``yourapp.views`` which imports a form that has autocomplete,
say ``SomeForm``, this would work:

.. code-block:: python
import autocomplete_Light
autocomplete_light.autodiscover()
from yourapp.views import SomeCreateView
But that wouldn't:

.. code-block:: python
from yourapp.views import SomeCreateView
import autocomplete_Light
autocomplete_light.autodiscover()
That is because auto-discovery of autocomplete classes should happen before
definition of forms using autocompletes.

Include ``autocomplete_light.urls``
-----------------------------------

Expand Down

0 comments on commit 0674edf

Please sign in to comment.