Commits

Mark Lavin committed bf2db22

Smarter documentation references. fixes #13.

Comments (0)

Files changed (4)

 
 Once installed you should add the urls to your root url patterns::
 
-    .. code-block::
-
         urlpatterns = patterns('',
             # Other patterns go here
             (r'^selectable/', include('selectable.urls')),
 a many to many relation to our `Fruit` model.
 
     .. literalinclude:: ../example/core/models.py
-        :lines: 11-17
+       :pyobject: Farm
 
 In `admin.py` we will define the form and associate it with the `FarmAdmin`.
 
     .. literalinclude:: ../example/core/admin.py
-        :lines: 12-36
+        :pyobject: FarmAdminForm
+
+    .. literalinclude:: ../example/core/admin.py
+        :pyobject: FarmAdmin
 
 You'll note this form also for new users to be created and associated with the
 farm if no user is found matching the given name. To make use of this feature we
 We can even make use of the same `FarmAdminForm`.
 
     .. literalinclude:: ../example/core/admin.py
-        :lines: 39-48
+        :pyobject: FarmInline
+    .. literalinclude:: ../example/core/admin.py
+        :pyobject: NewUserAdmin
 
 The auto-complete functions will be bound as new forms are added dynamically.
 
 should set two class attributes: `model` and `search_field`.
 
     .. literalinclude:: ../example/core/lookups.py
-        :lines: 1-10
+        :pyobject: FruitLookup
 
 The syntax for `search_field` is the same as the Django 
 `field lookup syntax <http://docs.djangoproject.com/en/1.2/ref/models/querysets/#field-lookups>`_. 

docs/quick-start.rst

 lookup which searchs models based on a particular field. Let's define a simple model:
 
     .. literalinclude:: ../example/core/models.py
-        :lines: 1-10
+        :pyobject: Fruit
 
 In a `lookups.py` we will define our lookup:
 
     .. literalinclude:: ../example/core/lookups.py
-        :lines: 1-10
+        :pyobject: FruitLookup
 
 This lookups extends `selectable.base.ModelLookup` and defines two things: one is
 the model on which we will be searching and the other is the field which we are searching.
 
 Below this definition we will register our lookup class.
 
-    .. literalinclude:: ../example/core/lookups.py
-        :lines: 12
+    .. code-block:: python
+
+        registry.register(FruitLookup)
 
 
 Defining Forms
 Now that we have a working lookup we will define a form which uses it:
 
     .. literalinclude:: ../example/core/forms.py
-        :lines: 1-13
+        :pyobject: FruitForm
+        :end-before: newautocomplete
 
 This replaces the default widget for the `CharField` with the `AutoCompleteWidget`.
 This will allow the user to fill this field with values taken from the names of
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.