#NEWLINE# def render( self , name , value , * args , **kwargs ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# lat = value . lat #NEWLINE# lng = value . lng #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# lat = settings . DEFAULT_LATITUDE #NEWLINE# lng = settings . DEFAULT_LONGITUDE #NEWLINE# #UNINDENT# js = ( '\n        </script>\n        <script type="text/javascript">\n            //<![CDATA[\n            var %(name)s_marker ;\n            $(document).ready(function () {\n                if (GBrowserIsCompatible()) {\n                    var map = new GMap2(document.getElementById("map_%(name)s"));\n                    map.setCenter(new GLatLng(%(default_lat)s,%(default_lng)s), 13);\n                    %(name)s_marker = new GMarker(new GLatLng(%(default_lat)s,%(default_lng)s), {draggable: true});\n                    map.addOverlay(%(name)s_marker);\n                    map.addControl(new GLargeMapControl());\n                    map.addControl(new GMapTypeControl());\n                    $(\'#%(name)s_id\')[0].value = %(name)s_marker.getLatLng().lat() + "," + %(name)s_marker.getLatLng().lng();\n                    GEvent.addListener(%(name)s_marker, "dragend", function() {\n                        var point = %(name)s_marker.getLatLng();\n                        $(\'#%(name)s_id\')[0].value = point.lat() + "," + point.lng();\n                    });\n                }});\n            $(document).unload(function () {GUnload()});\n            //]]>\n        </script>\n        ' % { #NEWLINE# #INDENT# 'name' : name , #NEWLINE# 'default_lat' : lat , #NEWLINE# 'default_lng' : lng , #NEWLINE# #UNINDENT# } ) #NEWLINE# html = self . inner_widget . render ( ( '%s' % lng ) , None , dict ( id = ( '%s_id' % name ) ) ) #NEWLINE# html += ( '<div id="map_%s" style="width: 500px; height: 500px"></div>' % name ) #NEWLINE# return mark_safe ( ( js + html ) )