Skip to content

Commit

Permalink
added documentation for autocomplete_app
Browse files Browse the repository at this point in the history
  • Loading branch information
paltman committed Jul 20, 2010
1 parent a87f61b commit 3cdb22d
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 1 deletion.
59 changes: 59 additions & 0 deletions docs/apps/autocomplete_app/gettingstarted.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
.. _ref-autocomplete_app-gettingstarted:

===============
Getting started
===============

This document is designed to get you up and running with the
``pinax.apps.autocomplete_app``...

Prerequisites
=============

These are the requirements to run ``pinax.apps.autocomplete_app``:

* Python **2.4+** (Python 3.x is **not** supported yet)
* Django **1.2+**
* ``pinax.apps.basic_profiles``
* ``pinax.apps.profiles``
* django-avatar (http://github.com/ericflo/django-avatar)
* django-friends (http://github.com/jtauber/django-friends/)

These dependencies should be added to your ``requirements/project.txt`` file
and installed using pip_. For example::

pip install -r requirements/project.txt

Installation
============

Add ``pinax.apps.autocomplete_app`` to your ``INSTALLED_APPS``:

.. code-block:: python

INSTALLED_APPS = [
# ...
"pinax.apps.autocomplete_app",
]

Usage
=====

After installing this app in your Django project, you now have access to easily
provide autocomplete lookups via client side javascript.

First, you'll want to wire up the appropriate urls for you app:

.. code-block:: python

urlpatterns = patterns("",
url(r"^username_autocomplete_friends/$", "pinax.apps.autocomplete_app.views.username_autocomplete_friends", name="profile_username_autocomplete_friends"),
url(r"^username_autocomplete/$", "pinax.apps.autocomplete_app.views.username_autocomplete_all", name="profile_username_autocomplete"),
)

The above url mapping will give you two different lookups, one using the
``django-friends`` app to look through just the logged in user's friends, and
the other looking through all users in the system.


.. _pip: http://pip.openplans.org/
13 changes: 13 additions & 0 deletions docs/apps/autocomplete_app/index.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. _ref-pinax.apps.autocomplete_app-index:

================
autocomplete_app
================

A utility app that provides autocomplete functionality to various other apps.

.. toctree::
:maxdepth: 3

gettingstarted
reference
18 changes: 18 additions & 0 deletions docs/apps/autocomplete_app/reference.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.. _ref-autocomplete_app-reference:

=========
Reference
=========

This document covers various components of ``pinax.apps.autocomplete_app``.


Modules
=======

``pinax.apps.autocomplete_app.views``
-------------------------------------

.. automodule:: pinax.apps.autocomplete_app.views
:members:
:undoc-members:
3 changes: 2 additions & 1 deletion docs/apps/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ Pinax Apps

account/index
analytics/index
authsub/index
authsub/index
autocomplete_app/index
8 changes: 8 additions & 0 deletions pinax/apps/autocomplete_app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@


def username_autocomplete_all(request):
"""
Provides username matching based on matches of the beginning of the
usernames of all users in the system.
"""
if request.user.is_authenticated():
from django.contrib.auth.models import User
from avatar.templatetags.avatar_tags import avatar
Expand Down Expand Up @@ -36,6 +40,10 @@ def username_autocomplete_all(request):


def username_autocomplete_friends(request):
"""
Provides username matching based on matches of the beginning of the
usernames of friends.
"""
if request.user.is_authenticated():
from friends.models import Friendship
from avatar.templatetags.avatar_tags import avatar
Expand Down

0 comments on commit 3cdb22d

Please sign in to comment.