Re: Send data back to a table from template or send back to a view
i had an array of coordinated tht i got from a dictionary via a view in views.py
now i used a javascript function in the template called index.html to find coordinates that are in a polygon
and i want to send the list of those coordinates back to the view so that i ca save them into a table.
views.py
# Import django modules
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.template.loader import render_to_string
from django.core.urlresolvers import reverse
from django.contrib.gis.geos import Point
from django.contrib.gis.gdal import DataSource
# Import system modules
import simplejson
import itertools
import tempfile
import os
import MySQLdb
# Import custom modules
from mochudimaps.locations.models import Location
from mochudimaps import settings
def index(request):
'Display map'
locations = Location.objects.order_by('name')
return render_to_response('locations/index.html', {
'locations': locations,
'content': render_to_string('locations/locations.html', {'locations': locations}),
}, context_instance=RequestContext(request))
--
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/-/odX6hK66IAsJ.
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