Django-CouchDB helper
Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
djcouch
.gitignore
README
setup.py

README

Installation:
    Add 'djcouch' to INSTALLED_APPS.
    Set settings.COUCHDB_HOST to the URL for your CouchDB server.
    Set settings.COUCHDB_DATABASES to a list of database names to use.
    Set settings.COUCHDB_DEFAULT_DATABASE to a preferred database name.
    Whenever you change your CouchDB view functions, run ./manage.py syncdb.

Usage example:

from django.shortcuts import render_to_response
import djcouch

def foo_index(request):
    """
    all_foo_slugs = function(doc) {
        emit(doc.slug, null);
    }
    """
    slugs = djcouch.view('all_foo_slugs', descending=False)
    return render_to_response('foo_index.html', locals())

def foo_detail(request, slug):
    foo = djcouch.get_document_or_404(slug)
    # Alternatively:
    #try:
    #    foo = djcouch.db[slug]
    #except djcouch.ResourceNotFound:
    #    raise Http404
    return render_to_response('foo_detail.html', locals())