I am trying to finish a geo Django tutorial which is quite old (1.3). Till now I was doing great but I am stucked with a specific error.
I am trying to build the functionality in which I save some data to the table in db. This is my view:
# Import django modules
from django.shortcuts import render_to_response
from django.template.loader import render_to_string
from django.http import HttpResponse
import simplejson
from waypoints.models import Waypoint
def save(request):
'Save waypoints'
for waypointString in request.POST.get('waypointsPayload', '').splitlines():
waypointID, waypointX, waypointY = waypointString.split()
waypoint = Waypoint.objects.get(id=int(waypointID))
waypoint.geometry.set_x(float(waypointX))
waypoint.geometry.set_y(float(waypointY))
waypoint.save()
return HttpResponse(simplejson.dumps(dict(isOk=1)), mimetype='application/json')
When I select the Save button I get an error (in firebug):403 Forbidden Now I know that is related with:
<h1>Forbidden <span>(403)</span></h1>
<p>CSRF verification failed. Request aborted.</p>
But I have no idea how to fix it.