Fixed #33886 -- Reallowed using GeoIP2() when GEOS is not installed.
Regression in 31bef51d8e
.
This commit is contained in:
parent
4e13b40a76
commit
e7afb8a180
|
@ -3,7 +3,6 @@ import socket
|
||||||
import geoip2.database
|
import geoip2.database
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.gis.geos import Point
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.core.validators import validate_ipv46_address
|
from django.core.validators import validate_ipv46_address
|
||||||
from django.utils._os import to_path
|
from django.utils._os import to_path
|
||||||
|
@ -219,6 +218,9 @@ class GeoIP2:
|
||||||
"Return a GEOS Point object for the given query."
|
"Return a GEOS Point object for the given query."
|
||||||
ll = self.lon_lat(query)
|
ll = self.lon_lat(query)
|
||||||
if ll:
|
if ll:
|
||||||
|
# Allows importing and using GeoIP2() when GEOS is not installed.
|
||||||
|
from django.contrib.gis.geos import Point
|
||||||
|
|
||||||
return Point(ll, srid=4326)
|
return Point(ll, srid=4326)
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -9,4 +9,5 @@ Django 4.1.1 fixes several bugs in 4.1.
|
||||||
Bugfixes
|
Bugfixes
|
||||||
========
|
========
|
||||||
|
|
||||||
* ...
|
* Reallowed, following a regression in Django 4.1, using ``GeoIP2()`` when GEOS
|
||||||
|
is not installed (:ticket:`33886`).
|
||||||
|
|
Loading…
Reference in New Issue