[Answer]-How to clear form submission data

1๐Ÿ‘

โœ…

I think its cleaner to redirect to the same page after the form is complete.
This way you use a fresh GET request without any problems when reloading the url.

if method.POST:
    ...
    if form.is_valid():
        ...
        return HttpResponseRedirect(request.path)
๐Ÿ‘คkanu

0๐Ÿ‘

if request.method == "POST":
    if form.is_valid():
        ...
        ...
        form = ABCForm()
        return render_to_response(request, context={'form':form}, RequestContext)

Here ABCForm is your django form name which you are passing in context for displaying in django template

๐Ÿ‘คNilesh

Leave a comment