2

Django OSMGeoAdmin with PointField uses OpenLayers and it's hard to use.

I want to add two new input elements which are lat and lng. Using jQuery, when values of the input elements are changed, I want to change point on the OpenLayers.

How can I do that?

No complete code or instructions are necessary, main idea is enough.

1

i dont know is there any difference with geodjando and OSMGeoAdmin but in normal geodjango if you want to update any field, you can use following code:

def updateVal(request):
  poId = request.POST.get("pointID", default=0)
  objGeo = request.POST.get("meta", default=0)

  f = Points.objects.get(id = poId)

  try:
      f.geom = objGeo 
      f.save()
      res = "OK"
  except:
      res = "ERROR"

i hope it helps you...

  • Thank You! but I want to do that in browser side. – ecabuk Dec 4 '12 at 15:56
  • You could pass an argument to this from the browser using an ajax request. – djq Feb 2 '13 at 22:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.