Couchdbkit: name 'DocumentForm' is not defined in django. How do I include and use it?

488 views Asked by At

I'd like to start using couchdbkit but I have come across a major stumbling block. The example code provided isn't working for me.

I keep getting an error saying that the name 'DocumentForm' is not defined.

Here is the code from the model

from couchdbkit.ext.django.schema import *

class Greeting(Document):
    author = StringProperty()
    content = StringProperty(required=True)

and view

from poly.learn.models import Greeting

class GreetingForm(DocumentForm):

    class Meta:
        document = Greeting

def home(request):

    greet = None

    if request.POST:
        form = GreetingForm(request.POST)
        if form.is_valid():
            greet = form.save()  
    else:
        form = GreetingForm()

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

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

It looks like I need to include and use another class. Does anyone know where it is?

Thanks.

1

There are 1 answers

1
Daniel Roseman On BEST ANSWER

It's in couchdbkit.ext.django.forms, as you could have found by looking through the code.