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.
精彩评论