mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #33924 -- Deprecated BaseGeometryWidget.map_height/map_width attributes.
This commit is contained in:
committed by
Mariusz Felisiak
parent
8c3046daad
commit
4fcba800b8
@@ -5,6 +5,7 @@ from django.contrib.gis.forms import BaseGeometryWidget, OpenLayersWidget
|
||||
from django.contrib.gis.geos import GEOSGeometry
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.test import SimpleTestCase, override_settings
|
||||
from django.utils.deprecation import RemovedInDjango51Warning
|
||||
from django.utils.html import escape
|
||||
|
||||
|
||||
@@ -485,3 +486,19 @@ class GeometryWidgetTests(SimpleTestCase):
|
||||
form = PointForm(data={"p": point.json})
|
||||
self.assertTrue(form.is_valid())
|
||||
self.assertEqual(form.cleaned_data["p"].srid, 4326)
|
||||
|
||||
def test_deprecated_width_and_height(self):
|
||||
class CustomGeometryWidget(forms.BaseGeometryWidget):
|
||||
map_height = 300
|
||||
map_width = 550
|
||||
|
||||
msg = (
|
||||
"The map_height and map_width widget attributes are deprecated. Please use "
|
||||
"CSS to size map widgets."
|
||||
)
|
||||
with self.assertRaisesMessage(RemovedInDjango51Warning, msg):
|
||||
CustomGeometryWidget()
|
||||
with self.assertRaisesMessage(RemovedInDjango51Warning, msg):
|
||||
forms.BaseGeometryWidget({"map_width": 400})
|
||||
with self.assertRaisesMessage(RemovedInDjango51Warning, msg):
|
||||
forms.BaseGeometryWidget({"map_height": 600})
|
||||
|
||||
Reference in New Issue
Block a user