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
a449b7ef
Kaydet (Commit)
a449b7ef
authored
Eki 30, 2015
tarafından
Sergey Fedoseev
Kaydeden (comit)
Claude Paroz
Kas 03, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #25629 -- Added checks of the number of arguments for GeoDjango DB functions.
üst
1b598b4b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
functions.py
django/contrib/gis/db/models/functions.py
+15
-9
test_functions.py
tests/gis_tests/geoapp/test_functions.py
+3
-0
No files found.
django/contrib/gis/db/models/functions.py
Dosyayı görüntüle @
a449b7ef
...
...
@@ -125,6 +125,8 @@ class OracleToleranceMixin(object):
class
Area
(
OracleToleranceMixin
,
GeoFunc
):
arity
=
1
def
as_sql
(
self
,
compiler
,
connection
):
if
connection
.
ops
.
geography
:
# Geography fields support area calculation, returns square meters.
...
...
@@ -204,11 +206,11 @@ class BoundingCircle(GeoFunc):
class
Centroid
(
OracleToleranceMixin
,
GeoFunc
):
pass
arity
=
1
class
Difference
(
OracleToleranceMixin
,
GeoFuncWithGeoParam
):
pass
arity
=
2
class
DistanceResultMixin
(
object
):
...
...
@@ -267,11 +269,11 @@ class Distance(DistanceResultMixin, OracleToleranceMixin, GeoFuncWithGeoParam):
class
Envelope
(
GeoFunc
):
pass
arity
=
1
class
ForceRHR
(
GeoFunc
):
pass
arity
=
1
class
GeoHash
(
GeoFunc
):
...
...
@@ -285,7 +287,7 @@ class GeoHash(GeoFunc):
class
Intersection
(
OracleToleranceMixin
,
GeoFuncWithGeoParam
):
pass
arity
=
2
class
Length
(
DistanceResultMixin
,
OracleToleranceMixin
,
GeoFunc
):
...
...
@@ -329,14 +331,17 @@ class Length(DistanceResultMixin, OracleToleranceMixin, GeoFunc):
class
MemSize
(
GeoFunc
):
output_field_class
=
IntegerField
arity
=
1
class
NumGeometries
(
GeoFunc
):
output_field_class
=
IntegerField
arity
=
1
class
NumPoints
(
GeoFunc
):
output_field_class
=
IntegerField
arity
=
1
def
as_sqlite
(
self
,
compiler
,
connection
):
if
self
.
source_expressions
[
self
.
geom_param_pos
]
.
output_field
.
geom_type
!=
'LINESTRING'
:
...
...
@@ -346,6 +351,7 @@ class NumPoints(GeoFunc):
class
Perimeter
(
DistanceResultMixin
,
OracleToleranceMixin
,
GeoFunc
):
output_field_class
=
FloatField
arity
=
1
def
as_postgresql
(
self
,
compiler
,
connection
):
dim
=
min
(
f
.
dim
for
f
in
self
.
get_source_fields
())
...
...
@@ -355,11 +361,11 @@ class Perimeter(DistanceResultMixin, OracleToleranceMixin, GeoFunc):
class
PointOnSurface
(
OracleToleranceMixin
,
GeoFunc
):
pass
arity
=
1
class
Reverse
(
GeoFunc
):
pass
arity
=
1
class
Scale
(
SQLiteDecimalToFloatMixin
,
GeoFunc
):
...
...
@@ -396,7 +402,7 @@ class SnapToGrid(SQLiteDecimalToFloatMixin, GeoFunc):
class
SymDifference
(
OracleToleranceMixin
,
GeoFuncWithGeoParam
):
pass
arity
=
2
class
Transform
(
GeoFunc
):
...
...
@@ -432,4 +438,4 @@ class Translate(Scale):
class
Union
(
OracleToleranceMixin
,
GeoFuncWithGeoParam
):
pass
arity
=
2
tests/gis_tests/geoapp/test_functions.py
Dosyayı görüntüle @
a449b7ef
...
...
@@ -160,6 +160,9 @@ class GISFunctionsTests(TestCase):
for
state
in
qs
:
self
.
assertTrue
(
state
.
poly
.
centroid
.
equals_exact
(
state
.
centroid
,
tol
))
with
self
.
assertRaisesMessage
(
TypeError
,
"'Centroid' takes exactly 1 argument (2 given)"
):
State
.
objects
.
annotate
(
centroid
=
functions
.
Centroid
(
'poly'
,
'poly'
))
@skipUnlessDBFeature
(
"has_Difference_function"
)
def
test_difference
(
self
):
geom
=
Point
(
5
,
23
,
srid
=
4326
)
...
...
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