diff options
| author | Aarni Koskela <akx@iki.fi> | 2022-08-03 16:39:35 +0300 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-08-03 18:31:15 +0200 |
| commit | a3ce58ac4c9fee7c769d48ad1c4df45fa4c1775b (patch) | |
| tree | bc26cde9f05db51285aca149e21ed0d62050870f | |
| parent | 9e9bdf8dbd6e2354a2e23aa7e37d5b491338085e (diff) | |
[4.1.x] Fixed #33886 -- Reallowed using GeoIP2() when GEOS is not installed.
Regression in 31bef51d8ea5e3bf650de1495ae1f0566670b8f3.
Backport of e7afb8a18061f664a5d20d409d423b77195e6060 from main
| -rw-r--r-- | django/contrib/gis/geoip2/base.py | 4 | ||||
| -rw-r--r-- | docs/releases/4.1.1.txt | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/django/contrib/gis/geoip2/base.py b/django/contrib/gis/geoip2/base.py index e74984fe45..14478942c0 100644 --- a/django/contrib/gis/geoip2/base.py +++ b/django/contrib/gis/geoip2/base.py @@ -3,7 +3,6 @@ import socket import geoip2.database from django.conf import settings -from django.contrib.gis.geos import Point from django.core.exceptions import ValidationError from django.core.validators import validate_ipv46_address from django.utils._os import to_path @@ -219,6 +218,9 @@ class GeoIP2: "Return a GEOS Point object for the given query." ll = self.lon_lat(query) if ll: + # Allows importing and using GeoIP2() when GEOS is not installed. + from django.contrib.gis.geos import Point + return Point(ll, srid=4326) else: return None diff --git a/docs/releases/4.1.1.txt b/docs/releases/4.1.1.txt index ff4085746d..67b0898e0e 100644 --- a/docs/releases/4.1.1.txt +++ b/docs/releases/4.1.1.txt @@ -9,4 +9,5 @@ Django 4.1.1 fixes several bugs in 4.1. Bugfixes ======== -* ... +* Reallowed, following a regression in Django 4.1, using ``GeoIP2()`` when GEOS + is not installed (:ticket:`33886`). |
