summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2022-04-22 11:36:27 +0200
committerGitHub <noreply@github.com>2022-04-22 11:36:27 +0200
commiteeb0bb63795f7500156abaed2a94aae681a9fc4a (patch)
tree71535b36835e3eee72253a22b3dcad62ba223220 /django
parent6f453cd2981525b33925faaadc7a6e51fa90df5c (diff)
Refs #27674 --- Deprecated django.contrib.gis.admin.OpenLayersWidget.
Diffstat (limited to 'django')
-rw-r--r--django/contrib/gis/admin/__init__.py2
-rw-r--r--django/contrib/gis/admin/widgets.py11
2 files changed, 12 insertions, 1 deletions
diff --git a/django/contrib/gis/admin/__init__.py b/django/contrib/gis/admin/__init__.py
index d5bd54c479..2c3de6f4c5 100644
--- a/django/contrib/gis/admin/__init__.py
+++ b/django/contrib/gis/admin/__init__.py
@@ -27,8 +27,8 @@ __all__ = [
"register",
"site",
"GISModelAdmin",
- "OpenLayersWidget",
# RemovedInDjango50Warning.
"GeoModelAdmin",
+ "OpenLayersWidget",
"OSMGeoAdmin",
]
diff --git a/django/contrib/gis/admin/widgets.py b/django/contrib/gis/admin/widgets.py
index 420c170608..9ba262aaf8 100644
--- a/django/contrib/gis/admin/widgets.py
+++ b/django/contrib/gis/admin/widgets.py
@@ -1,9 +1,12 @@
+# RemovedInDjango50Warning.
import logging
+import warnings
from django.contrib.gis.gdal import GDALException
from django.contrib.gis.geos import GEOSException, GEOSGeometry
from django.forms.widgets import Textarea
from django.utils import translation
+from django.utils.deprecation import RemovedInDjango50Warning
# Creating a template context that contains Django settings
# values needed by admin map templates.
@@ -16,6 +19,14 @@ class OpenLayersWidget(Textarea):
Render an OpenLayers map using the WKT of the geometry.
"""
+ def __init__(self, *args, **kwargs):
+ warnings.warn(
+ "django.contrib.gis.admin.OpenLayersWidget is deprecated.",
+ RemovedInDjango50Warning,
+ stacklevel=2,
+ )
+ super().__init__(*args, **kwargs)
+
def get_context(self, name, value, attrs):
# Update the template parameters with any attributes passed in.
if attrs: