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