Can't map existing CouchDB docs

31 views
Skip to first unread message

John A

unread,
May 19, 2013, 5:53:23 PM5/19/13
to couch...@googlegroups.com
Hi i'm new to Python/Django and am having some real trouble wrapping my head around mapping my existing CouchDB docs.

I'm building on the Greetings demo but end up getting either KeyError exceptions or no results displayed. Here's what I've got so far:

CouchDB view:
"map": "function(doc) { \n     if (doc.header != null)\n emit(doc._id, doc); \n}"

Models.py
class Greeting(Document):
    header = StringProperty()

    class Meta:
        app_label = "greeting"


Views.py
greetings = Greeting.view('greeting/all')

    return render("home.html", {
        "form": form,
        "greet": greet,
        "greetings": greetings
    }, context_instance=RequestContext(request))

greetings seems is where I'm having the problem, it looks like it gets the results from the CouchDB view and returns the correct amount of rows, but the rows don't get mapped to the Greeting model. Any idea where I might be going wrong?

Benoit Chesneau

unread,
May 22, 2013, 9:52:06 AM5/22/13
to couch...@googlegroups.com
mmm you didn't defined the fields?
> --
> You received this message because you are subscribed to the Google Groups
> "couchdbkit" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to couchdbkit+...@googlegroups.com.
> To post to this group, send email to couch...@googlegroups.com.
> Visit this group at http://groups.google.com/group/couchdbkit?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages