ref: context value "id"
This commit is contained in:
@@ -28,6 +28,7 @@ class MapLocationWidget(Widget):
|
|||||||
|
|
||||||
def get_context(self, name, value, attrs):
|
def get_context(self, name, value, attrs):
|
||||||
context = super().get_context(name, value, attrs)
|
context = super().get_context(name, value, attrs)
|
||||||
|
context['id'] = context['widget']['attrs']['id']
|
||||||
context['map_options'] = json.dumps(
|
context['map_options'] = json.dumps(
|
||||||
context['widget']['attrs'].get('options'))
|
context['widget']['attrs'].get('options'))
|
||||||
return context
|
return context
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<div style="width: 100%">
|
<div style="width: 100%">
|
||||||
<input name="{{ widget.name }}" id="{{ widget.attrs.id }}_value" type="hidden" value="{{ widget.value|default:'' }}" />
|
<input name="{{ widget.name }}" id="{{id}}_value" type="hidden" value="{{ widget.value|default:'' }}" />
|
||||||
<div id="{{ widget.attrs.id }}_map" style="width: 100%; height: 400px"></div>
|
<div id="{{id}}_map" style="width: 100%; height: 400px"></div>
|
||||||
<a href="" id="{{ widget.attrs.id }}_reset">Remove</a>
|
<a href="" id="{{id}}_btn"></a>
|
||||||
<script>
|
<script>
|
||||||
MapLocationInit("{{ widget.attrs.id }}", {{ map_options|safe }});
|
MapLocationInit("{{id}}", {{ map_options|safe }});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
Reference in New Issue
Block a user