doc updates for sphinx

This commit is contained in:
James Turk 2009-10-23 14:43:17 -04:00
parent 46b0c81e4c
commit 78ed569b35
2 changed files with 35 additions and 12 deletions

View File

@ -52,7 +52,7 @@ It is possible to serve as many layers as you desire from a single Layar endpoin
and should return a queryset of the objects for :class:`LayarView` to paginate and return. and should return a queryset of the objects for :class:`LayarView` to paginate and return.
:func:`poi_from_LAYERNAME_item` is called on each item being returned, and should convert items :func:`poi_from_LAYERNAME_item` is called on each item being returned, and should convert items
into :class:`POI` objects. into :class:`layar.POI` objects.
It is usually best to then create an instance of your derived class in your application's ``views.py`` It is usually best to then create an instance of your derived class in your application's ``views.py``
@ -86,3 +86,15 @@ In urls.py it is then necessary to map a URL directly to ``busstop_layar``::
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^layar_endpoint/$', 'myapp.views.busstop_layar'), url(r'^layar_endpoint/$', 'myapp.views.busstop_layar'),
) )
Additional Settings
-------------------
Your :class:`LayarView`-derived class can also set a number of options. These options should be suitable for most purposes as Layar doesn't display more than 50 points, but are available should you for any reason need to change them.
``results_per_page``
controls the number of results returned at once (default: 15)
``max_results``
controls the maximum number of results across all pages (default: 50)
``verify_hash``
set to False to disable hash verification (useful for testing, shouldn't be False in production)

View File

@ -79,18 +79,29 @@ class LayarView(object):
To add a layar it is necessary to write two functions: To add a layar it is necessary to write two functions:
``get_LAYERNAME_queryset`` ``get_LAYERNAME_queryset``
return a queryset of objects to be used to build the layer This function is passed latitude, longitude, radius,
``poi_from_LAYERNAME_item`` radio_option, search_query, and slider_value parameters.
radio_option, search_query, and slider_value may be None
depending on how you've configured your widgets on layar.com
**Note:** It is strongly recommended that you make this function
accept **kwargs for maximum compatibility
``poi_from_LAYERNAME_item(item)``
convert an item of whatever type is returned by convert an item of whatever type is returned by
get_LAYARNAME_queryset into a ``POI`` object :func:`get_LAYARNAME_queryset` into a ``POI`` object
This separation allows LayarView to handle pagination correctly. This separation allows LayarView to handle pagination correctly.
Options: Your derived class can also set a number of options. The defaults
should be suitable for most purposes as Layar doesn't display more
than 50 points.
``results_per_page`` ``results_per_page``
defaults to the Layar-recommended 15 controls the number of results returned at once (default: 15)
``max_results`` ``max_results``
defaults to the Layar-recommended 50 controls the maximum number of results across all pages (default: 50)
``verify_hash`` ``verify_hash``
set to False to disable hash verification (useful for testing) set to False to disable hash verification (useful for testing)
''' '''