Re: CSRF Issue
ahem, so here is the view
from wikicamp.wiki.models import Page
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.shortcuts import redirect
from django import forms
import htmllib
from django.template import RequestContext, loader
from django.core.context_processors import csrf
# Create your views here.
def view_page(request, page_name):
c = {}
try:
page = Page.objects.get(pk=page_name)
except Page.DoesNotExist:
return render_to_response("create.html", {"page_name":page_name}
, context_instance=RequestContext(request))
content = page.content
# content = request.GET['content']
return render_to_response("view.html", {"page_name":page_name, "content":content})
#, context_instance=RequestContext)
def edit_page(request, page_name):
c = {}
try:
page = Page.objects.get(pk=page_name)
content = page.content
except Page.DoesNotExist:
name = ""
# content = request.GET['content']
content = ""
return render_to_response("edit.html", {"page_name":page_name, "content":content})
def save_page(request, page_name):
c = {}
content = request.POST.get['content', 'this is the default']
try:
page = Page.objects.get(pk=page_name)
content = request.GET['content']
page.content = 'content'
except Page.DoesNotExist:
page = Page(name-page_name, content-content)
page.save()
return HttpResponseRedirect("/granite/" + "page_name" + "/")
On Thursday, June 14, 2012 3:46:24 AM UTC-4, cmac0tt wrote:
I feel like an idiot here, I've worked my way around this multiple times but its just not working this time and as you can see ive thrown every method there is in the documentation at it.--(note that I am learning python and django right now on the fly) however here is my views, the form with the token, and my models (threw in the middleware settings from my settings.py and my urls just in case. Let me know if you need anything else. Remember, just learning here, and learning by converting a walkthrough presentation of building a wiki on pre 0.96 on 1.4 so I've had to learn a lot of changes etc. Its helping, mind you, this one step is getting frustrating now after two nights of it.let me know if you have any ideas, and remember, I'm not big on the snake talk just yet.Thanks.
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/IGTVuRc1nqQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home