Saturday, May 31, 2014

Re: prevent from backward in form

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


On Sun, Jun 1, 2014 at 5:24 AM, Russell Keith-Magee <russell@keith-magee.com> wrote:
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.hallaji1@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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/CAJxq84_WHOYvREdAzPhfznu2nxNR0u9xJJbGzhqsTwP-aW6Fbg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/CAP0yp48ohEa6wEustBpmTsycDEjQS10KE1ej3pc1BCVUitWOtw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment