Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
32969c39
Kaydet (Commit)
32969c39
authored
May 02, 2016
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs
2bd1bbc4
-- Made GeometryField.get_db_prep_lookup() a private (deprecated) method.
üst
eab5df12
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
29 deletions
+15
-29
fields.py
django/contrib/gis/db/models/fields.py
+12
-26
query.py
django/contrib/gis/db/models/query.py
+3
-3
No files found.
django/contrib/gis/db/models/fields.py
Dosyayı görüntüle @
32969c39
...
...
@@ -295,40 +295,26 @@ class GeometryField(GeoSelectFormatMixin, BaseSpatialField):
defaults
[
'widget'
]
=
forms
.
Textarea
return
super
(
GeometryField
,
self
)
.
formfield
(
**
defaults
)
def
get_db_prep_lookup
(
self
,
lookup_type
,
value
,
connection
,
prepared
=
False
):
def
_get_db_prep_lookup
(
self
,
lookup_type
,
value
,
connection
):
"""
Prepare for the database lookup, and return any spatial parameters
necessary for the query. This includes wrapping any geometry
parameters with a backend-specific adapter and formatting any distance
parameters into the correct units for the coordinate system of the
field.
Only used by the deprecated GeoQuerySet and to be
RemovedInDjango20Warning.
"""
# special case for isnull lookup
if
lookup_type
==
'isnull'
:
return
[]
elif
lookup_type
in
self
.
class_lookups
:
# Populating the parameters list, and wrapping the Geometry
# with the Adapter of the spatial backend.
if
isinstance
(
value
,
(
tuple
,
list
)):
params
=
[
connection
.
ops
.
Adapter
(
value
[
0
])]
if
self
.
class_lookups
[
lookup_type
]
.
distance
:
# Getting the distance parameter in the units of the field.
params
+=
self
.
get_distance
(
value
[
1
:],
lookup_type
,
connection
)
elif
lookup_type
in
connection
.
ops
.
truncate_params
:
# Lookup is one where SQL parameters aren't needed from the
# given lookup value.
pass
else
:
params
+=
value
[
1
:]
elif
isinstance
(
value
,
Expression
):
params
=
[]
else
:
params
=
[
connection
.
ops
.
Adapter
(
value
)]
return
params
# Populating the parameters list, and wrapping the Geometry
# with the Adapter of the spatial backend.
if
isinstance
(
value
,
(
tuple
,
list
)):
params
=
[
connection
.
ops
.
Adapter
(
value
[
0
])]
# Getting the distance parameter in the units of the field.
params
+=
self
.
get_distance
(
value
[
1
:],
lookup_type
,
connection
)
else
:
raise
ValueError
(
'
%
s is not a valid spatial lookup for
%
s.'
%
(
lookup_type
,
self
.
__class__
.
__name__
))
params
=
[
connection
.
ops
.
Adapter
(
value
)]
return
params
def
get_prep_lookup
(
self
,
lookup_type
,
value
):
if
lookup_type
==
'contains'
:
...
...
django/contrib/gis/db/models/query.py
Dosyayı görüntüle @
32969c39
...
...
@@ -453,7 +453,7 @@ class GeoQuerySet(QuerySet):
# Using the field's get_placeholder() routine to get any needed
# transformation SQL.
geom
=
geo_field
.
get_prep_value
(
settings
[
'procedure_args'
][
name
])
params
=
geo_field
.
get_db_prep_lookup
(
'contains'
,
geom
,
connection
=
connection
)
params
=
geo_field
.
_
get_db_prep_lookup
(
'contains'
,
geom
,
connection
=
connection
)
geom_placeholder
=
geo_field
.
get_placeholder
(
geom
,
None
,
connection
)
# Replacing the procedure format with that of any needed
...
...
@@ -510,7 +510,7 @@ class GeoQuerySet(QuerySet):
raise
ValueError
(
'Unknown distance function:
%
s'
%
func
)
geom_3d
=
geo_field
.
dim
==
3
# The field's get_db_prep_lookup() is used to get any
# The field's
_
get_db_prep_lookup() is used to get any
# extra distance parameters. Here we set up the
# parameters that will be passed in to field's function.
lookup_params
=
[
geom
or
'POINT (0 0)'
,
0
]
...
...
@@ -526,7 +526,7 @@ class GeoQuerySet(QuerySet):
(
not
geography
)
and
length
):
lookup_params
.
append
(
'spheroid'
)
lookup_params
=
geo_field
.
get_prep_value
(
lookup_params
)
params
=
geo_field
.
get_db_prep_lookup
(
'distance_lte'
,
lookup_params
,
connection
=
connection
)
params
=
geo_field
.
_
get_db_prep_lookup
(
'distance_lte'
,
lookup_params
,
connection
=
connection
)
# The `geom_args` flag is set to true if a geometry parameter was
# passed in.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment