Exemple #1
0
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())
Exemple #2
0
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())
Exemple #3
0
def submit(request):
    text = request.POST.get('text', 'no-text')
    return djng.Response(djng.escape(text.upper()))
Exemple #4
0
def search(request):
    return djng.Response(
        "This page would search for %s" % djng.escape(
            request.GET.get('q', 'no-search-term')
        )
    )
Exemple #5
0
def submit(request):
    text = request.POST.get('text', 'no-text')
    return djng.Response(djng.escape(text.upper()))
Exemple #6
0
def search(request):
    return djng.Response(
        "This page would search for %s" % djng.escape(
            request.GET.get('q', 'no-search-term')
        )
    )