<s> from datetime import datetime <EOL> from django . shortcuts import render_to_response as render <EOL> from django . template import RequestContext , loader , Context <EOL> from couchdbkit . ext . django . forms import DocumentForm <EOL> from djangoapp . greeting . models import Greeting <EOL> class GreetingForm ( DocumentForm ) : <EOL> class Meta : <EOL> document = Greeting <EOL> def home ( request ) : <EOL> greet = None <EOL> if request . POST : <EOL> form = GreetingForm ( request . POST ) <EOL> if form . is_valid ( ) : <EOL> greet = form . save ( ) <EOL> else : <EOL> form = GreetingForm ( ) <EOL> greetings = Greeting . view ( '<STR_LIT>' , descending = True ) <EOL> return render ( "<STR_LIT>" , { <EOL> "<STR_LIT>" : form , <EOL> "<STR_LIT>" : greet , <EOL> "<STR_LIT>" : greetings <EOL> } , context_instance = RequestContext ( request ) ) </s>
