python - Redirect to home page with arguments after submiting form in django -


I am trying to add the details of students, who are Django & amp; When submitting the 'Post' method I save the details in my 'Pie' file. After that I want to redirect to home page

  return to render_to_response ("home.html", {"edit": 0, "msg": 'saved') , Context_instance = RequestContext (request))   

But on every refresh of the home page it will insert the data into the table, then I tried to use "HTTPRPSPoint Redirect", but passed this argument Will not support it. How can I solve it?

add.py

  stud = student (name = request.POST ['studname']) stud.save () return render_to_response ("  

student.html

  ", {" edit ":" msg ": 'saved'}, context_instance = RequestContext (request) code> & lt; form id = "AddForm" name = "addForm" action = "" method = 'post' '& lt; table & gt; & lt; tr & gt; & lt; td & gt; name. & Lt; / td & Gt; & lt; td & gt; & lt; input type = "text" name = "standalone" id = "studname" & gt; & lt; / td> & lt; / tr & gt; & lt; / Table & gt; & lt; / Forms & gt;    

You should see.

Actually,

  • su Make sure that you have a POST method that handles posts
  • Then redirect the user to a specific page.
  • Then there is a GET request page .

    What you can think of here:

    Use Django

      def submitting_student (request): If request.method = = "Post": stud = student (name = request. ('Home.html', {"edit": 0, "msg": 'saved'}) return render_to_response ("student.html")  There is another post on topic similar to  

    here

  • Comments

    Popular posts from this blog

    java - ImportError: No module named py4j.java_gateway -

    python - Receiving "KeyError" after decoding json result from url -

    .net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -