def view(request):
    from django import forms
    from django.http import HttpResponse
    from django.shortcuts import redirect
    from django.template import Context, Template

    class TestForm(forms.Form):
        name = forms.CharField()

    if request.POST:
        form = TestForm(request.POST)
        if form.is_valid():
            return redirect('/view/')
    else:
        form = TestForm()

    template = Template("{{ form }}")
    context = Context({'form' : form})

    return HttpResponse(template.render(context))
Test view that returning form
dataset/ETHPy150Open kmmbvnr/django-any/django_any/tests/test_client.py/view