Re: nothing i can do about "CSRF token missing or incorect" -- beginner
it suddenly got solved. i don't know how but now it's working. anyway i didn't know exactly what this CSRF do but thanks to you i now do know. thanks again.. On Tuesday, September 2, 2014 4:25:11 PM UTC+4:30, François Schiettecatte wrote: > > Did you check that the csrf_token is actually inserted into the form by > looking at the HTML in the browser? > > François > > On Sep 2, 2014, at 3:57 AM, aseds> wrote: > > > i searched and tried what i found to solve it, but... > > here is my edit.html which contains my form: > > > > > > > > > > {{ page_name }} - Editing > > > > > > > > Editing {{ page_name }} > > > > {% csrf_token %} > > {{ content > }} > > > > > > > > > > > > > > and here is my views.py: > > > > # ... > > > > def edit_page(request, page_name): > > try: > > page = Page.objects.get(pk = page_name) > > content = page.contents > > except Page.DoesNotExist: > > content = "" > > return render(request, "edit.html", {"page_name": > page_name, "content": content}) > > > > # ... > > > > > > i changed my views.py as was suggested in a webpage to this: > > > > @csrf_protect > > def edit_page(request, page_name): > > c = {} > > try: > > page = Page.objects.get(pk = page_name) > > content = page.contents > > except Page.DoesNotExist: > > content = "" > > return render(request, "edit.html", {"page_name": > page_name, "content": content}, c) > > > > > > but it didn't help. > > thank you for your help. > > > > > > > > -- > > 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/0acb15b8-6752-4930-8e72-c3c77ec9bd32%40googlegroups.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+unsubscr...@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/59ce8509-3cca-45c5-934e-042da25c673d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: nothing i can do about "CSRF token missing or incorect" -- beginner
Did you check that the csrf_token is actually inserted into the form by looking at the HTML in the browser? François On Sep 2, 2014, at 3:57 AM, asedswrote: > i searched and tried what i found to solve it, but... > here is my edit.html which contains my form: > > > > > {{ page_name }} - Editing > > > > Editing {{ page_name }} > > {% csrf_token %} > {{ content > }} > > > > > > > and here is my views.py: > > # ... > > def edit_page(request, page_name): > try: > page = Page.objects.get(pk = page_name) > content = page.contents > except Page.DoesNotExist: > content = "" > return render(request, "edit.html", {"page_name": page_name, > "content": content}) > > # ... > > > i changed my views.py as was suggested in a webpage to this: > > @csrf_protect > def edit_page(request, page_name): > c = {} > try: > page = Page.objects.get(pk = page_name) > content = page.contents > except Page.DoesNotExist: > content = "" > return render(request, "edit.html", {"page_name": page_name, > "content": content}, c) > > > but it didn't help. > thank you for your help. > > > > -- > 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+unsubscr...@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/0acb15b8-6752-4930-8e72-c3c77ec9bd32%40googlegroups.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+unsubscr...@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/B82B6A46-B77B-4E8A-9C0F-168B80E1A816%40gmail.com. For more options, visit https://groups.google.com/d/optout.
nothing i can do about "CSRF token missing or incorect" -- beginner
i searched and tried what i found to solve it, but... here is my edit.html which contains my form: {{ page_name }} - Editing Editing {{ page_name }} {% csrf_token %} {{ content }} and here is my views.py: # ... def edit_page(request, page_name): try: page = Page.objects.get(pk = page_name) content = page.contents except Page.DoesNotExist: content = "" return render(request, "edit.html", {"page_name": page_name, "content": content}) # ... i changed my views.py as was suggested in a webpage to this: @csrf_protect def edit_page(request, page_name): c = {} try: page = Page.objects.get(pk = page_name) content = page.contents except Page.DoesNotExist: content = "" return render(request, "edit.html", {"page_name": page_name, "content": content}, c) but it didn't help. thank you for your help. -- 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+unsubscr...@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/0acb15b8-6752-4930-8e72-c3c77ec9bd32%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.