Skip to content

Commit ada75cd

Browse files
committed
Remove map_height/map_width variables and inline CSS block
1 parent 7e909b0 commit ada75cd

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

CHANGES

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
CHANGELOG
33
=========
44

5-
0.32.1 (unreleased)
5+
0.33.0 (unreleased)
66
-------------------
77

88
- CSP: Don't test nonce for truthiness before inclusion #393
99
- Solve broken marker image paths in the admin panel #392
10+
- `map_width` and `map_height` are no longer supported in LeafletWidget `attrs`,
11+
use traditional CSS to dimension maps (you can target the class
12+
`.leaflet-container-default` for example.)
1013

1114
0.32.0 (2025-05-14)
1215
-------------------

docs/widget.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ To show a textarea input for the raw GeoJSON geometry, override admin ``form_fie
9393
from django.contrib.gis.db import models as geo_models
9494

9595
LEAFLET_WIDGET_ATTRS = {
96-
'map_height': '500px',
97-
'map_width': '100%',
9896
'display_raw': 'true',
9997
'map_srid': 4326,
10098
}

leaflet/templates/leaflet/widget.html

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@
44
{{ FORCE_IMAGE_PATH|json_script:"force-img-path" }}
55
{{ reset_view_icon|json_script:"Control-ResetView-ICON" }}
66

7-
<style nonce="{{ csp_nonce }}">
8-
{% block map_css %}
9-
{% if map_width and map_height %}#{{ id_map }} { width: {{ map_width|unlocalize }}; height: {{ map_height|unlocalize }}; }{% endif %}
10-
{% if not display_raw %}#{{ id_css }} { display: none; }{% endif %}
11-
{% endblock map_css %}
12-
</style>
13-
147
<script nonce="{{ csp_nonce }}">
158
{% block vars %}var {{ module }} = {};
169
{{ module }}.fieldid = '{{ id_css }}';
@@ -53,4 +46,4 @@
5346
target="_blank"
5447
rel="nofollow">valid GeoJSON Geometry</a>:</p>
5548
{% endif %}
56-
<textarea id="{{ id_css }}" class="required django-leaflet-raw-textarea {{ class }}" cols="150" rows="10" name="{{ name }}">{{ serialized }}</textarea>
49+
<textarea id="{{ id_css }}" class="required django-leaflet-raw-textarea {{ class }}" cols="150" rows="10" name="{{ name }}{% if not display_raw %} hidden{% endif %}">{{ serialized }}</textarea>

0 commit comments

Comments
 (0)