def validate(request): if request.method == 'POST': form = DemoForm(request.POST) if form.is_valid(): return djng.Response( 'Form was valid: %s' % djng.escape(repr(form.cleaned_data))) else: form = DemoForm() return djng.Response(""" <form action="/validate/" method="post"> %s <p><input type="submit"> </form> """ % form.as_p())
def validate(request): if request.method == 'POST': form = DemoForm(request.POST) if form.is_valid(): return djng.Response('Form was valid: %s' % djng.escape( repr(form.cleaned_data) )) else: form = DemoForm() return djng.Response(""" <form action="/validate/" method="post"> %s <p><input type="submit"> </form> """ % form.as_p())
def submit(request): text = request.POST.get('text', 'no-text') return djng.Response(djng.escape(text.upper()))
def search(request): return djng.Response( "This page would search for %s" % djng.escape( request.GET.get('q', 'no-search-term') ) )