summaryrefslogtreecommitdiff
path: root/main/widgets.py
diff options
context:
space:
mode:
authoretienne <etienne@9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864>2009-01-23 22:34:35 +0000
committeretienne <etienne@9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864>2009-01-23 22:34:35 +0000
commitccea45fa5494a2a89b99e0a222c16ee897884b09 (patch)
tree5bb7708cec5051ee370989c1b053a6d58459b95f /main/widgets.py
parenta8bdd41fd72ec1bfd4d1632274f0bc30e57fb00c (diff)
downloadChimère-ccea45fa5494a2a89b99e0a222c16ee897884b09.tar.bz2
Chimère-ccea45fa5494a2a89b99e0a222c16ee897884b09.zip
Modification of hard link to manage then in settings. Correction of false submission of route.
git-svn-id: http://www.peacefrogs.net/svn/chimere/trunk@26 9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864
Diffstat (limited to 'main/widgets.py')
-rw-r--r--main/widgets.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/main/widgets.py b/main/widgets.py
index 8e6bd19..4bf95fc 100644
--- a/main/widgets.py
+++ b/main/widgets.py
@@ -24,6 +24,7 @@ Extra widgets and fields
from django import forms
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
+from django.contrib.gis.geos import fromstr
from chimere import settings
from django.contrib.gis.db import models
@@ -180,9 +181,16 @@ onclick='toggleDrawOff();'>%s</div>
tpl += """<script type='text/javascript'><!--
init();"""
if value:
- tpl += """
+ val = value
+ if type(value) == unicode:
+ try:
+ val = fromstr(value)
+ except:
+ pass
+ if hasattr(val, 'json'):
+ tpl += """
var geometry='%s';
-initFeature(geometry);""" % value.json
+initFeature(geometry);""" % val.json
tpl += """
// --></script>
"""