prevent from backward in form

25 views
Skip to first unread message

Ali hallaji

unread,
May 31, 2014, 12:23:12 PM5/31/14
to django...@googlegroups.com
I submit the form and when I resend or backward the my webpage, my form dose appear again and save data in duplicate.
please help me for solving this issue.

Russell Keith-Magee

unread,
May 31, 2014, 8:54:39 PM5/31/14
to Django Users
Hi Ali,

If you follow the pattern laid out in Django's documentation, you'll avoid the problem:

https://docs.djangoproject.com/en/dev/topics/forms/#using-a-form-in-a-view

The key part is that on success, the form processing issues a HTTPResponseRedirect. This prevents the back button from repopulating the form - even if it redirects to the same URL that you used to submit the form in the first place.

Yours,
Russ Magee %-)


On Sun, Jun 1, 2014 at 12:23 AM, Ali hallaji <ali.ha...@gmail.com> wrote:
I submit the form and when I resend or backward the my webpage, my form dose appear again and save data in duplicate.
please help me for solving this issue.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7841d7d1-f282-4530-9516-bf019c6a067f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ali hallaji

unread,
Jun 1, 2014, 12:19:37 AM6/1/14
to django...@googlegroups.com
Hi Russ,
thank you so much for reply.
But I tested ago the form with  HTTPResponseRedirect and this don't work for me.
I decide to save csrf token in my models and check it in view and this solution work for me.
Best Regards,
Hallaji


--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/KoackP6Jeaw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages