开发者

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

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 = Stri开发者_如何学运维ngProperty()
    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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜