summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-12-13 09:08:03 +0100
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-01-15 22:28:37 +0100
commit4104dafdf3607c259309a0edd3bfd7169d88ac18 (patch)
tree66e80cd1074d296a1023adfcef07444aaf96bb28
parentf3a2509a54e0b5513199efca5e41a5183fc097f0 (diff)
Removed django.contrib.gis.geoip2.GeoIP2.coords() per deprecation timeline.
-rw-r--r--django/contrib/gis/geoip2.py9
-rw-r--r--docs/ref/contrib/gis/geoip2.txt8
-rw-r--r--docs/releases/6.0.txt2
-rw-r--r--tests/gis_tests/test_geoip2.py9
4 files changed, 2 insertions, 26 deletions
diff --git a/django/contrib/gis/geoip2.py b/django/contrib/gis/geoip2.py
index 5b510dee7f..4de3e585f0 100644
--- a/django/contrib/gis/geoip2.py
+++ b/django/contrib/gis/geoip2.py
@@ -214,15 +214,6 @@ class GeoIP2:
"is_in_european_union": response.country.is_in_european_union,
}
- def coords(self, query, ordering=("longitude", "latitude")):
- warnings.warn(
- "GeoIP2.coords() is deprecated. Use GeoIP2.lon_lat() instead.",
- RemovedInDjango60Warning,
- stacklevel=2,
- )
- data = self.city(query)
- return tuple(data[o] for o in ordering)
-
def lon_lat(self, query):
"Return a tuple of the (longitude, latitude) for the given query."
data = self.city(query)
diff --git a/docs/ref/contrib/gis/geoip2.txt b/docs/ref/contrib/gis/geoip2.txt
index 2d0fafa8ef..89664f6b37 100644
--- a/docs/ref/contrib/gis/geoip2.txt
+++ b/docs/ref/contrib/gis/geoip2.txt
@@ -141,14 +141,6 @@ Returns the country name corresponding to the query.
Coordinate Retrieval
--------------------
-.. method:: GeoIP2.coords(query)
-
-Returns a coordinate tuple of (longitude, latitude).
-
-.. deprecated:: 5.1
-
- Use :meth:`.GeoIP2.lon_lat` instead.
-
.. method:: GeoIP2.lon_lat(query)
Returns a coordinate tuple of (longitude, latitude).
diff --git a/docs/releases/6.0.txt b/docs/releases/6.0.txt
index 5871f09e7b..63401e1ac5 100644
--- a/docs/releases/6.0.txt
+++ b/docs/releases/6.0.txt
@@ -305,3 +305,5 @@ to remove usage of these features.
* The undocumented ``django.utils.itercompat.is_iterable()`` function and the
``django.utils.itercompat`` module is removed.
+
+* The ``django.contrib.gis.geoip2.GeoIP2.coords()`` method is removed.
diff --git a/tests/gis_tests/test_geoip2.py b/tests/gis_tests/test_geoip2.py
index 61b3565d1c..aa74837e4f 100644
--- a/tests/gis_tests/test_geoip2.py
+++ b/tests/gis_tests/test_geoip2.py
@@ -201,15 +201,6 @@ class GeoLite2Test(SimpleTestCase):
version = f"{m.binary_format_major_version}.{m.binary_format_minor_version}"
self.assertEqual(repr(g), f"<GeoIP2 [v{version}] _path='{g._path}'>")
- def test_coords_deprecation_warning(self):
- g = GeoIP2()
- msg = "GeoIP2.coords() is deprecated. Use GeoIP2.lon_lat() instead."
- with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
- e1, e2 = g.coords(self.ipv4_str)
- self.assertIsInstance(e1, float)
- self.assertIsInstance(e2, float)
- self.assertEqual(ctx.filename, __file__)
-
def test_open_deprecation_warning(self):
msg = "GeoIP2.open() is deprecated. Use GeoIP2() instead."
with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx: